Skip to main content

Posts

Showing posts from January, 2023

Learn All About Machine Learning

  INTRODUCTION TO MACHINE LEARNING The field of machine learning is a big one, and it's not limited to just computer science students. In fact, you can learn all about machine learning by reading this page We'll go over what machine learning is and why it's important for technology. Then we'll break down types of machine learning and how they work in everyday life. Finally, we'll look at some examples where AI has changed our lives for the better—from healthcare to education—and why more people should be interested in this topic! What is Machine learning Machine learning is a type of artificial intelligence that allows computers to learn from data, make predictions and decisions. It's used in many different ways, such as: 1.) To make predictions about future events based on past experience 2.) To automate tasks so the computer can perform them without human intervention or assistance 3.) To improve the user experience by recommending products or services based o...

C++ Variables and Operators

  Variable A variable in C++ is a name for a piece of memory that can be used to store information. There are many types of variables, which determines the size and layout of the variable's memory; Variable names   we can use any combination of letters and numbers for Variable and function names but it must start with a letter. We can use Underscore (_) as a letter in variable name and can begin with an underscore But Identifiers beginning with an underscore are reserved, And identifiers beginning with an underscore followed by a lower case letter are reserved for file scope identifiers Therefore using underscore as starting letter is not desirable. Akki and akki are different identifiers because upper and lower case letters are treated as different identifiers  Variable Types There are many 'built-in' data types in C. short int -128 to 127 (1 byte) unsigned short int 0 to 255 (1 byte) char 0 to 255 or -128 to +127 (1 byte) unsigned char 0 to 255 (1 byte) signed char -128...

Learn C++ Advance

Exception Handling Exceptions provide a way to react to exceptional circumstances (like runtime errors) in our program by transferring control to special functions called handlers. C++ exception handling is built upon three keywords: try, catch, and throw. throw: A program throws an exception when a problem shows up. This is done using a throw keyword. catch: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception. try: A try block identifies a block of code for which particular exceptions will be activated. It's followed by one or more catch blocks. Assuming a block will raise an exception, a method catches an exception using a combination of the try and catch keywords. A try/catch block is placed around the code that might generate an exception. Code within a try/catch block is referred to as protected code, and the syntax for using try/catch looks like the f...

Basic C++ File Handling

  9.1 File Handling A file is collection of related records, a record is composed of several fields and field is a group of character. This requires another standard C++ library called fstream which defines three new data types: - Ofstream This data type represents the output file stream and is used to create files and to write information to files. - Ifstream This data type represents the input file stream and is used to read information from files. - Fstream This data type represents the file stream generally, and has the capabilities of both ofstream and ifstream which means it can create files, write information to files, and read information from files. File Operations 1. Open an existing file 2. Read from file 3. Write to a file 4. Moving a specific location in a file(Seeking) 5. Closing File Opening a File A file must be opened before you can read from it or write to it. Either the ofstream or fstream object may be used to open a file for writing and ifstream objec...

Learn C++ Object Oriented Programming(OOP) from Basis To Advance

  8.1 Classes Basics Classes are an expanded concept of data structures: like data structures, they can contain data members, but they can also contain functions as members. An object is an instantiation of a class. In terms of variables, a class would be the type, and an object would be the variable. Classes are defined using either keyword class or keyword struct, with the following syntax: class class_name { access_specifier_1: member1; access_specifier_2: member2; ... } object_names; Where class_name is a valid identifier for the class, object_names is an optional list of names for objects of this class. The body of the declaration can contain members, which can either be data or function declarations, and optionally access specifiers. Classes have the same format as plain data structures, except that they can also include functions and have these new things called access specifiers. An access specifier is one of the following three keywords: private, public or protected. These...

C++ Functions

  7.1 Function Basics A function is a group of statements that together perform a task. All C programs made up of one or more functions. There must be one and only one main function. You can divide up your code into separate functions. How you divide up your code among different functions is up to you, but logically the division usually is so each function performs a specific task. A program will be executing statements sequentially inside one function when it encounters a function call. A function call is an expression that tells the CPU to interrupt the current function and execute another function. The CPU 'puts a bookmark' at the current point of execution, and then calls (executes) the function named in the function call. When the called function terminates, the CPU goes back to the point it bookmarked, and resumes execution. Function definition return_type function_name( parameter list ) { //statements } - The return_type is the data type of the value the function returns...

Learn C++ Flow of Control

6.1 Conditional branching - if if statement An if statement contains a Boolean expression and block of statements enclosed within braces. Structure of if statement if (boolean expression )  /* if expression is true */ statements... ; /* Execute statements */ If the Boolean expression is true then statement block is executed otherwise (if false) program directly goes to next statement without executing Statement block. if...else statement If statement block with else statement is known as as if...else statement. Else portion is non-compulsory. Structure of if...else if(condition) {   statements... } else {   statements... } If the condition is true, then compiler will execute the if block of statements, if false then else block of statements will be executed. Nested if...else statement We can use multiple if-else for one inside other this is called as Nested if-else. Structure of Nested if...else if(condition) {   statements... } else if {   statements... } else ...

Learn C++ Input and Output

5.1 cout (output stream) On most program environments, the standard output by default is the screen, and the C++ stream object defined to access it is cout. cout is an instance of iostream class For formatted output operations, cout is used together with the insertion operator, which is written as << (i.e., two "less than" signs). cout << "this is Output"; // prints this is Output sentence on screen cout << 50; // prints number 50 on screen cout << x; // prints the value of x on screen The << operator inserts the data that follows it into the stream that precedes it. In the examples above, it inserted the literal string Output sentence, the number 120, and the value of variable x into the standard output stream cout. Notice that the sentence in the first statement is enclosed in double quotes (") because it is a string literal, while in the last one, x is not. The double quoting is what makes the difference; when the text is enclos...

Learn C++ Compound Types

\ Arrays  Array is a fixed size collection of similar data type items. Arrays are used to store and access group of data of same data type. Arrays can of any data type. Arrays must have constant size. Continuous memory locations are used to store array. It is an aggregate data type that lets you access multiple variables through a single name by use of an index. Array index always starts with 0. Example for Arrays: int a[5]; // integer array char a[5]; // character(string) array In the above example, we declare an array named a. When used in an array definition, the subscript operator ([]) is used to tell the compiler how many variables to allocate. In this case, we’re allocating 5 integers/character. Each of these variables in an array is called an element. Types of Arrays: # One Dimensional Array # Two Dimensional Array # Multi Dimensional Array  Array declaration int age [5]; Array initialization int age[5]={0, 1, 2, 3, 4, 5}; Accessing array age[0]; /*0_is_accessed*/ age[1...

An Example of C++ Program

Structure of program /*This Program prints Hello World on screen*/ #include <iostream.h> using namespace std; int main() { count << "Hello World"; return 0; 1 . /* This program ... */ The symbols/* and*/ used for comment. This Comments are ignored by the compiler, and are used to provide useful information about program to humans who use it. 2. #include <iostream.h> This is a preprocessor command which tells compiler to include iostream.h file. 3. using namespace std;  All the elements of the standard C++ library are declared within what is called a namespace, the namespace with the name std. So in order to access its functionality we declare with this expression that we will be using these entities. This line is very frequent in C++ programs that use the standard library. 4. main() C++ programs consist of one or more functions. There must be one and only one function called main. The brackets following the word main indicate that it is a function and not a ...

Introduction To C++

Introduction To C++   Note: Guys this is my first post on c++  As you go through this site you will see alot of  tutorial on c++ .To make it easy for you to access i will leave a link for you to go over to another page(another section of the tutorial) INTRODUCTION TO C++ C++ is a general-purpose, case-sensitive, free-form programming language that supports procedural, object-oriented, and generic programming. C++ is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features. C++ was developed by Bjarne Stroustrup of AT&T Bell Laboratories in the early 1980's, and is based on the C language. The "++" is a syntactic construct used in C (to increment a variable), and C++ is intended as an incremental improvement of C. Most of C is a subset of C++, so that most C programs can be compiled (i.e. converted into a series of low-level instructions that the computer can execute dire...