You are on page 1of 6

BASIC C++ BY NAEEM 1. Beginning Code: #include<iostream.h> #include<conio.

h> void main() { clrscr(); cout<<Welcome to C++; getch(); }

2. Break line code: #include<iostream.h> #include<conio.h> void main() { Clrscr(); cout<<Noor is a good boy \n I like Noor; getch(); } 3. Tab Code: #include<iostream.h> #include<conio.h> void main() { Clrscr(); cout<<Babar is good boy \t I like Babar; getch(); } 4. Table Code: #include<iostream.h> #include<conio.h> void main() { Clrscr(); cout<<Name \t F/Name \t Course \t Timing \n; cout<<Ali \t H.Noor \t D.I.T \t 3:00; cout<<<<Khan \t D.I.T \t 3:00; getch(); } 5. Adding Code: #include<iostream.h> #include<conio.h>

BASIC C++ BY NAEEM void main() { Clrscr(); int a; int b; int c; a=10; b=20; c=a+b; cout<<The Answer of a and b is =; cout<<c; getch(); } 6. Subtracted Code: #include<iostream.h> #include<conio.h> void main() { clrscr(); int a; int b; int c; a=10; b=20; c=a-b; cout<<The Answer of a and b is =; cout<<c; getch(); } 7. Adding Numbers with Points Code: #include<iostream.h> #include<conio.h> void main() { float a; float b; float c; a=10.44; b=20.77; c=a+b; cout<<The Answer of a and b is =; cout<<c; getch(); }

BASIC C++ BY NAEEM 8. Adding Numbers in C screen code: #include<iostream.h> #include<conio.h> void main() { int a; int b; int c; cout<<Enter the value of a; cin>>a; cout<<Enter the value of b; cin>>b; cout<<The Answer of a & b is=; c=a+b; cout<<c; getch(); } 9. Tells about the less than or greater than of the preceded number. #include<iostream.h> #include<conio.h> void main() { int a; int b; cout<<Enter the value of number; cin>>a; if(a>100) cout<<The number is greater then 100; else cout<<The number is less than 100; getch(); } 10. Pass and Fail code: #include<iostream.h> #include<conio.h> void main() { Int a; cout<<Enter the value of student; cin>>a; if(a>33) cout<<Pass; else cout<<Fail;

BASIC C++ BY NAEEM getch(); } 11. Just Pass, Pass and Fail code: #include<iostream.h> #include<conio.h> void main() { Int a; cout<<Enter the value of student; cin>>a; if(a= =33) cout<<Just pass; else if(a>33) cout<<Pass; else cout<<Fail; getch(); } 12. Pass or Fail by writing student name and number in C screen. #include<iostream.h> #include<conio.h> void main() { Clrscr(); char name[40]; int a; cout<<Enter the name of student; cin>>name; cout<<Enter the number of student; cin>>a; if(a>=33) cout<< Pass Mr. else cout<<Fail Mr. cout<<name; getch(); }

13. Table Code: #include<iostream.h>

BASIC C++ BY NAEEM #include<conio.h> void main() { Clrscr(); Int a; Int b; Cout<<Enter the number:; Cin>>a; For(b=1;b<=10;b++ cout<<a<<x<<=<<a*b<<\n; Getch(); } 14. Putting the beginning and ending value: #include<iostream.h> #include<conio.h> void main() { Clrscr(); Int a; Int b; Int c; Cout<<Enter the table value; Cin>>a; Cout<<Enter the ending value; Cin>>b; For(c=1;<<a=b;C++) Cout<<a<<x<<c<<=<<a*c<<\n; Cout<<c; Getch(); }

15.Calculator codes: #include<iostream.h> #include<conio.h> void main() { int a, int b; char oper;

BASIC C++ BY NAEEM cout<<Enter the First Number; cin>>a; cout<<Enter the Second Number; cin>>b; cout<<Enter the Operator ; cin>>oper; if(oper = =+) cout<<a+b; else if(oper= =-) cout<<a-b; if(oper = =*) cout<<a*b; else if(oper= =/) cout<<a/b; else cout<<Unknown Operator; getch(); }

You might also like