Posts

Showing posts from April, 2017

Operators

Operators: Following are the mostly used operators of C++: 1. And operator (denoted by &&) 2. Or operator (dented by ||) 3. Not operator (denoted by !) 4. Modulus operator (denoted by %)

if-else and if-else-if C++ programs

if-else & if-else-if Programs: Program: #include < iostream > using namespace std; int main() { int a; cin >> a; if(a == 5) { cout << "Yes, the number is 5" << endl; } else { cout << "No; the number is not 5" << endl; } return 0; } Program 2: #include < iostream > using namespace std; int main() { int a; cin >> a; if (a == 1) { cout << "1" << endl; } else if (a == 2) { cout << "2" << endl; } else { cout << "none" << endl; } return 0; }

If-else syntax

if-else codition: Syntax: if (condition) { } else { } if-else-if codition: if (condition) { } else if (condition) { } else { }

Swapping of Variables

Swapping of Variables: Swapping: Swapping of variables means Interchanging the values of variables Program: #include < iostream > using namespace std; int main() { int a = 10; int b = 20; int c; c = a; a = b; b = c; cout << a << " " << b << endl; return 0; }

Exponentials

To get 2 inputs from the user whose result is getting by using Exponentials: Program: #include < iostream > using namespace std; int main() { int a , b , p = 1; cout << "Enter base = "; cin >> a; cout << "Enter Power = "; cin >> b; for (int k = 1; k <= b; k++) { p = p * a; cout << "The result is = " << p << endl; } return 0; }

Sum of Different Variables

Sum of Different Numbers: Program: #include < iostream > using namespace std; int main() { int a; int sum=0; for(int k = 0; k < 5; k++) { cin >> a; sum = sum + a; cout << "The sum = " << " " << sum << endl; } return 0; }

C++ Programming: Linear Search Algorithm

Image

Passing Arrays to Functions

Image

C++ Programming: Arrays Part 2

Image

Introductio to Arrays

Image

C++ Programming Tutorial for Beginners Part 7

Image

C++ Programming Tutorial for Beginners Part 6

Image

C++ Programmig Tutorial for Beginners Part 5

Image

C++ Programming Tutorials for Beginners Part 4

Image

C++ Programming Tutorial for Beginners (Relational Operators) Part 3

Image

C++ Programming Tutorials for Beginners Part 2

Image

C++ Programming Tutorial for beginners Part 1

Image

for loop C++ programs

Programs to give numbers with the output according to the loop: #include < iostream > using namespace std; int main() { for(int j = 1; j <= 10; j++) { cout << j << "Program" << endl; } return 0; } In the following program we starts our loop from 1 and ends at 10 . We gives the ending condition as less than and equals to 10 so that the loop will starts from 1 and ends at 10 And also we uses the variable j in the display syntax so that the numbers will display in the output according to the loop. #include < iostream > using namespace std; int main() { for(int j = 0; j < 10; j++) { cout << j+1 << "Program" << endl; } return 0; } In the following program we starts our loop from 0 and ends at 10 means that the program will run 10 times. and in the display syntax we uses j+1 means that in the loop , first j=0 and according to the codition 1 will be adde...

To display the output more than one time using for loop in C++ programming

Program to display output five times: #include < iostream > using namespace std; int main () { for(int a = 0; a < 5; a++) { cout << "Program"; } return 0; } To display in a sequence: #include < iostream > using namespace std; int main () { for(int a = 0; a < 5; a++) { cout << "Program" << endl; } return 0; } with the use of endl the output will show in a line. To display in a single line with space: #include < iostream > using namespace std; int main () { for(int a = 0; a < 5; a++) { cout << "Program" << " "; } return 0; } Add space in the inverted commas in the display syntax.

Repeatative Structures in C++ programming

Repeatative Structures: Loops are uses to repeat values. The two types of loops are as follow: i. for Loop ii. while Loop * for Loop: It has three points i.e.; i. Starting point ii. Ending point iii. Counter Syntax: for(starting point; ending point; counter) { (statement) } for(int i=0; i { (statement) } in the above syntax we first declares an integer type variable and gives that the starting point i.e.; 0 and then gives that the ending point i.e.; less than 5 This means that the loop will start from 0 and stops after five turns. At the last there are double + with that variable use for next turn. This is called the counter .

Add commas around a word in C++ programming

To add commas around a word: Program: #include < iostream > using namespace std; int main(); { cout << " ' " << "Program" << " ' " << endl; return 0; }

Addition of two variables when user gives the value in C++ programming

Sum of variables when user gives input: Program: #include < iostream > using namespace std; int main() { int a , b; cin >> a; cin >> b; cout << "sum = " << a + b << endl; return 0; } Or #include < iostream > using namespace std; int main() { int a , b; cin >> a >> b; cout << "sum = " << a + b << endl; return 0; }

How to get input from the user in a C++ program

To Get Input From The User: Syntax: The syntax used to get input from the user is cin>> . Program: #include < iostream > using namespace std; int main() { int a; cin >> a; cout << "The value = " << a << endl; return 0; }

Subtract of two variables in C++ programming

subtraction.learnprogramming.com Subtraction of two variables: #include < iostream > using namespace std; int main() { int a ; int b ; int result = 0 ; a = 4 ; b = 3 ; result = a - b ; cout << result << endl ; return 0; }

How to divide two variables in C++ programming

division.learnprogramming.com Division of two variables: #include < iostream > using namespace std; int main() { int a ; int b ; int result = 1 ; a = 2 ; b = 3 ; result = a / b ; cout << result << endl ; return 0; }

To find the Product of two variables in C++ programming

product.learnprogramming.com Product of two variables: #include < iostream > using namespace std; int main() { int a ; int b ; int product = 1 ; a = 2 ; b = 3 ; product = a * b ; cout << product << endl ; return 0; }

Sum of Variables in C++ programming

< sum.fashionandcs.com To find sum of two variables: #include < iostream > using namespace std; int main() { int a ; int b ; int sum = 0 ; a = 2 ; b = 3 ; sum = a + b ; cout << sum << endl ; return 0; } In the following program we declares two variables a and b and give there values as 2 and 3 respectively. We also declare a variable 'sum' that is equals to 0 to avoid the garbage value And then we add both variables that is equals to sum . Now the compiler will give 5 as output. First the values of both a and b i.e.; 2 and 3 will add and then it will stores in the variable sum . And as we our displaying sum so whatever the value is store will be dislay as output Garbage Value: Whenever we declare a variable a garble value is already stored in it. And when we assigns our own value to that variable it will replace. The garbage value will then destroy.

Declaring Integer type Variable and storing Values in C++ programming

integerdeclaration.fashionandcs.com Integer type Variable: To store an integer type value we first declare a variable by using int and then stores an integer value in that variable. Actually int means integer type variable For example if we want to store 2 to a variable we will write the following program. #include < iostream > using namespace std; int main() { int a; a=2; return 0; } To display integer value stores in variable: And if you want to display this on compiler , write the following program #include < iostream > using namespace std; int main() { int a; a=2; cout << a << endl; return 0; } In this program the compiler will show 2 because we stored this on variable a Also We never uses " around a this is the reason that it will show 2 as output. If we use inverted commas " around a the compiler will show a as output.

Datatype

variablesdeclaration.fashionandcs.com Datatype: Datatype is actually something that tells the type of the data. Types of datatype: To declare a variable we uses int, char, double, long, float, string etc. We will discuss them briefly one by one.

How to skip a line in C++ Program

http://skipline.fashionandcs.com To Skip A Line: Syntax: To skip a line in C++ Programming, the syntax used is endl #include < iostream > using namespace std; int main() { cout << "Programming" << endl; return 0; }

How to display the output in C++

http://codingc++.fashionandcs.com Program to display the output : Syntax: The syntax used to display the output within the C++ Program is cout must use angle brackets << and the semi colon ; with the sysntax if we want to display the word same as written, we uses " like: we want to display the word program we will write as: cout<<"program"; You can see the folowing program #include < iostream > using namespace std; int main() { cout << "Programming"; return 0; }

Basic Structure of C++

http://programming.fashionandcs.com Basic structure of C++ program The four basic terms uses for C++ program are as follow: #include < iostream > using namespace std; int main() return 0; In the program it will be written as: #include < iostream > using namespace std; int main() { (statement) return 0; }

Fashion introduction

Image
Fashion "Fashion" Name: Fashion is a popular style or practice, especially in clothing,footwear,accessories,makeup,body or furniture . Fashion is a distinctive and often constant treand in the style in which a person dresses.It is the prevailing styles in behavior and the newest creations of designers. About Fashion Is Fashion is not harmful to society? I do not believe that fashion is harmful to society. I think that fashion increases and benefits society. If everyone was wearing the same thing it would be a very boring society. Fashion as far as clothes stimulates society. Also it stimulates society via television. This is done with shows such as america's next top model and project runway. Some Points about Fashion The most beautiful makeup of a woman is passion.But cosmetics are easier to buy. Fasion changes but style endures. Fashion is not something that exists in dresses only.Fashion is in the sky,in the street,fashion h...

introduction to programming

Image
https://www.youtube.com/watch?v=R6nApgQLFeg

computer programming

Image
Computer Programming " Computer Programming by Maksha Riaz " search: click here: Computer Programming by Maksha Riaz Computer Programming (programming) is a process that leads from an original formulation of a computing problem to executable computer programs . Programming involves activities such as analysis, developing understanding, generating algorithms , verification of requirements of algorithms included their correctness and resources consumption, and implementation of algorithms in a target programming language . Basic Terms : > Program: Set of instructions given to the computer to solve the specific problem in the form of programming language. > Programming Languages: The language that a computer can understand. Types of Programming Language: There are two types of programming language . Low Level Programming Language High Level Programming Language Programming Langu...