Monday, 28 October 2013

Table in c++ with help of For loop

# include<iostream.h> using namespace std; void main() { int a,i; cout<<"Enter Number"; cin>>a; for(i=1;i<=10;i++) { cout<<a<<"*"<<i<<"="<<a*i<<endl; } } Now, We will explain this program, First we take two integers,(Find all data members ranges at:-http://www.jdrana.blogspot.com/2013/10/add-numbers-in-c.html) then...

Wednesday, 23 October 2013

For Loop

# include<iostream> # include<conio.h> void main() { int i; for(i=0;i<9;i++) cout<<"i am JD"; } In this program,we will discuss how for loop works in c++......! for(i=0; what is this?? here we simply declare i to 0... then we i<9 this is condition this for loops works when i is less then 9 and at last i++; this is the increment operator we discuss in previous post... first i will become zero then the condition will check if the condition is true then the loop prints whatever type in next line or compiler will do what is...

Increment and decrement

# include<iostream> using namespace std; void main() { int a; cout<<"Enter a"; cin>>a; a++; cout<<a; a--; cout<<a; } here we will take any value from the user and that value is save in a... then a will be incremented Incremented mean to add one more to some variable like here a++ mean if a==1 then after incremented a will be 2... after printing a on screen a will be decremented like a--; Decremented mean to minus one to some variable like here a-- if a==2 ten after decremented a will be 1; Your Suggestions will help...

Saturday, 19 October 2013

Add numbers in C++

# include<iostream> using namespace std; void main() { int a,b,c; cout<<"enter first number"<<endl; cin>>a; cout<<"Enter second number"; cin>>b; c=a+b; cout<<"The sum is"<<c<<endl; } here, int is used for  integer (positive and negative)type.... here are all c++ data types and there ranges signed char: -127 to 127 (note, not -128 to 127; this accommodates 1's-complement platforms) unsigned char: 0 to 255 "plan" cha: -127 to 127 or 0 to 255 (depends on default char signedness) signed...

Learn Programming in c++

# include<iostream>uisng namespace std;void main(){cout<<"I am JD"<<endl;} here #  is used for the folder location(c++ compiler automatically known where headers files is) include is used to inculde some header file in your program(we willl discuss later what is header file) iostream is the header file..... It is used for cin & cout etc etc..... using namespace std; Namespaces are like drawers in a filing cabinet. All of the standard library is in one drawer, and the only way to get to the stuff in that drawer is to...