[1]
Programming
C++
Programme :- User Programme
Use User Problem Solve
Programming :- User Programme
Programming
Programming Language :- Computer
Symbol , Special Character , Pantuation Mark Etc. Use Programme
Programming Language Component Use
Programme –
Computer Programming Language Use
1. Low Level Language
2. High Level Language
3. 4GL ( General Language)
1. Low Level Language :- Low Level Language Programming Language
Computer Deficult Programming Language ,
Language Opereter Character Use (0,Computer
Deficult Programming Langauge Language Operator
Character Use (0,1) Form Programming Develop
Aseembaly Language System Programming Language
[2]
:- Assembrety Language Etc.
2. High Level Language :- User Under Standeful Programming Language
, Programming Language
Programme User ,
Programming Language
Predefind - Print, Input, Cut, Count, Etc, Programming Language
Predefind – Print, Input, Cut, Count, Etc - Number Character
Use Programme Language
Programme Programming Translated Translate Low Label
Covert
:– C, C++, Java, VB ( Visual Basic ), Oracal Etc.
3._4GL (Fourth Generation Programming Language ) :- Computer
Programming Language Language Predefind
Tag Use Programme Language Use
D.B.M.S. (Data Base Management System) R.D.B.M.S. (Relation Data Base
Mangement System) Programme Use
– Foxpro , SQL (Siquenicial Queary Language )
Compiler :- Programming Translater High Label
Language Statement Translate Low Label Language
Convert C++ Compiler Base Programming Language GSA
Compiler High Label Language Data Translate
Low Language Convert
Inter Pitel :- Translate High Label Language
Low Language Data Convert Line By Line
Line Translate
[3]
Linker :- High Label Language Programme Statement Header
File Link Auto Erase File Convert User
Programme Run
Programming Solve Tracking :- Computer User
Problem Solve Method Programming Solve Tracking
1. ALGORITHMS :- Programming Code Use
Programme Step By Step Programming
Code Algorithms
Syntax :- Input A - Step 1
Input B - Step 2
C = A+B - Step 3
Print C - Step 4
2. FLOW CHART :- User Statement - Graphic
Symbol Show Flow Chart Flow Chart
Use User Manual Programme
Example :- Addition Of Two Number ( Number )
Start / Stop Box
Input / Output Box
[4]
Processing Box
Decision Box
Flow Line
Connector
Start
Input
A , B
C = A+B
C = A+B
Stop
[5]
Use :-
+, -,*,1,%
<,>,<=,>=,!=,==
Example:- Creat A Flow Chart To Show The Maximum Number of
Given These Deferent Number?
( - Number Flow Chart )
A=10
B=15
C=7
Start
Input a,b,c
If
a>b&>c
F - T
Print a greater
Print b is greater
Print c is greater
if
b>c
Stop
[6]
Example:-1 Print the all Number Between one two Hundred By Using of flow
chart ?
( 100 Flow Chart - -)
A=1 1 Print
A=A+1 2 “ “ “
A=A+1 3 “ “ “
A=A+1 4 “ “ “
Start
Input a,b,
,
1 100
Print
While
A<=b
1
100
A
<
=
b
2 100
Print a
A
=
a
+
2
Print a
A
=
a
+
1
[7]
Example:-2 Print the table of any Given Number ?
Number Table Print
- axb=c
5x1=5
5x2=10
5x3=15
5x4=20
…..........
………...
…………
5x10=50
Example:-3 Print the Any Year Leap Year Are not which Given By
User ?
29 Leap Year
Year 4 0 , Leap Year
- 2000/4 = 5 Leap Year
Start
Input a,b,=1,c
Start
C
=
a*b
While
B<=10
Print C
B
=
b+1
[8]
Example:-4 Print the Reverse Desist Of Given Number ?
Value Reverse ()
445 544
135 = 531
A = 135
135 = 531
531
135%10
Start
Input Year
If
Year%4==0
1==0
A
Leap Year
Not Leap Year
Start
[9]
135%10
13%10
1%10
OPERATORS :- Predefined Symbol
Programming Particular Problem Solve
Type Operator Use C++
1. Mathematical ( + , - , * , / , % )
2. Logical Operator ( $$ , !! , : , = , # )
3. Comparison Operator ( > , < , > = , < = , = = )
4. Conditional Operator ( ? , ; )
Start
Input a
While
a >=1
b
=
a
/
10
Print b
A
=
a
/
10
[10]
5. Can Cat Net ( $ $ )
Operator Variable Number Number
Use
PREFIX:- Prefix Operator , Variable Use
Note :- Variable Problem Solve , Value
Assign
Syntax :- a = 5 a = a+1
B = ++a a = 5+1
A = C a = b
B = C
POST FIX :- Variable Use , Operator Use
Note :- Post Fix Variable Value Assign ,
Increasment And Decreasment
Syntax :- (a++) A = a+1
a - - a = a-1
a = 10 b = a++
a = 10 or
b = a –
a = a+1
[11]
a = 11 a = 9
a = b-1
Example:- 1.
a = 12
b = 9 a++ = a+1 a-- = 14
a = 12+1 13+1 = 14-1
a = 13 a = 14 a = 13
Post Fix
Syntax :-
C = ( + + a ) + ( b + +) + ( a++) + ( ++b ) – ( a--)
C = 13+9+13+11-14
C = 33, a=13, b=11
Example:- 2.
a = 2
b = 3
C = ( a + + ) + ( + + a ) + ( a + +) + ( + + b ) + ( b + + ) – ( - - a)
C = 14 , a = 4 , b = 5
a = 2+1
a = 3+1 b = 3+1
a = 4+1 b = 4+1
a = 5-1 b = 5
a = 4
[12]
Example:- 3.
a = 5
b = 7
C = ( a++ ) + (a - - ) + ( + + a) + ( - - b ) – ( + + b)
C = 5 + 6 + 6 + 6 – 7
C = 16 , a = 6 , b = 7 Ans.
A = 5 – 6 a = 6 – 5 { Prefix Posit Fix )
A = 6 – 1 a = 6 { - - a a - -}
A = 5-1 { ++ ++}
A = 6
Example:- 4. a = 6
b = 9
C = ( - - a ) + ( - - a ) + ( a - - ) + ( + + a ) + ( - - b ) – ( + + b ) + ( a + +) – ( b - - )
C = 5 + 4 + 4 + 4 + 8 – 9 + 4 – 9
C = 11 , a = 5 , b = 8 Ans.
a = 6 – 1 b = 9 – 1
a = 5 -1 b = 8 + 1
a = 4 + 1 b = 9 – 1
a = 5 + 1 b = 8
a = 6
Example:- 5. a = 5
B = 8
[13]
C = ( - - a ) + ( a + + ) + ( a - - ) + ( - - a ) – ( - - b ) + ( b + + ) + ( b - - ) – ( b - - b )
C = 4 + 4 + 5 + 3 – 7 + 7 + 8 – 6
C = 18 , b = 6 , a = 3 Ans
a = 5 – 1 b = 8 – 1
a = 4 + 1 b = 7 + 1
a = 5 – 1 b = 8 – 1
a = 4 – 1 b = 7 – 1
a = 3 b = 6
VARIABLE :- Predefind Meaningful Words Alphabate ,
Memory Address Alocate , Constainst Value Store
CONDITIONAL OF VARIABLE :-
1. Variable English Small Latter Start
2. Variable 8 Character Alphabetic
3. Variable Number Start Alphabetic Number
Use
4. Variable Key Words
5. Int . ( Intiger , Float , Void , Main sps. )
DATA TAYPE :- Data Type Programming Most Important 8 ,
Programming Variable Minimum Maximum Value ( Range )
Present C++ Data Type Use
Data Memory Storage Minimum Value Maximum :-
Int ( Integer ) 2 -32768 +32767
[14]
Char (Charccter) 1 -128 +127
Assign(Character) 1 0 +255
Maximum Data Type Memory Storage Minimum :-
Float 43 – 4 x 10 -33 3 – 4 x 10 +38
Long 4 – 2147783648 +2147483647
Dobule 8 – 7 x 10 -308 + 1 – 7 x 10 +308
Long Double 10 – 3 – 4 x 10 2.1x10
STATEMENT :- Programming Line
Statement Character Use
:- Variable Constant
Int a = log
Data Type Operator
CONSTANT ( Fixed Value ) :- Constant Fix Value ,
Programming Value Change Constant
Variable Store
Syntax :- a = 5
Variable Constant
KEY WORDS :- Predefind Meaningful Word Function
Compile Specific Explain Key Word Specific
Execute Key Word Part Key Word
[15]
Key Words
Primary Secondary
Int Struct
Floot Function
Void Class
If Painter
Else Enams
Switch Etc.
Case
Continue
Break
Do
While
For
Etc.
{ = Corlibrases } = Stream
( ) Parathanses “ “ Space
[16]
FRIST PROGRAME IN C++ :-
File Edit View
# Include < IO Stream.h > ( )
Void Main ()
{
Statement ;
Statement ;
Statement;
}
# INCLUDES :- Preprossor Directive Meaning
Computer Already Explain Computer Programming
Execute Statement According Header File Include
VOID MAIN :- Void Main Use Programming Returning Type Show
Void Main Programme Character (
Returning Type ) Show
USER STATEMENT Void Main Colorbreeds ({})
TYPE OF VERSION OF ‘C++’ :-
1 = Ansciic
[17]
2 = Tc ( Turboc )
3 = ( Bord Lands )
4 = ( Break the line and start New Line )
Syntax :- Print the constant Value in C++ programming
COUT ( << ) :- Use Value Output (Print )
Resutted Value Count Use Header
File <IO Stream.H>
CIN ( >> ) :- Get Character Use User
Value Get Header File <IO Stream.H>
Note :- Cin Inverted Comma Cout
Metrification :-
F2 => Save
F3 => Open
Alt+R => Run
Ctrl+F9 => Run
# Include < IO Stream H >
Void Main.C
{
Cout<< “Computer Point”;
}
[18]
Ctrl+F5 => Complete ( Output )
Example :- Write A Program To Print The Additional of two Numbers which
Given By User ( Number )
( Get the Any character From User )
#
Include<
iostream.H>
#Include <conio.H>
Void main ( )
{
Int a,b,c = 0 ;
Clrscr ( ) ;
Count << “Please input the frist number =”;
Cin > > b ;
C = a+b ;
Cout <<”the result of given number =”<<c ;
Getch ( ) ;
F2 = Save
Alt + r = Run
[19]
Example :-1 Average :-
Line Break
Example 2 :- SQRT ( ) :-
#Include<iostream.h>
#Include<conio.h>
Void main ( )
{
Float a,b,c,d ;
Clrscr ( ) ;
Cout<<”input the second number =”;
Cin>>b ;
C = a+b ;
Cout<<”result of given number =”<<”in”;>>
D = C/ 2 ;
Cout<< “show the result =”<<d ;
Getch ( ) ;
}
#Include<iostream.h>
#Include<conio.h>
#Include<math.h>
Void main ( )
{
Float int a,b ;
[20]
Example :-3 Input the Mark in Subject the total of percentage ?
Clrscr ( ) ;
Count<< “number =” ;
Cin>>a ;
b = sqrt (a) ;
Cout<< “sqrt = <<b ;
Getch ( ) ;
}
Percentage = 335 x 100
500
#Include<iostream.h>
#Include<conio.h>
Void main ( )
{
Int m1, m2, m3, m4, m5
Float p = 0 ;
Clrscr ( ) ;
Cout<< “please inter the subject in five marks” ;
Cin>>m1>>m2>>m3>>m4>>m5>>;
T = m1+m2+m3+m4+m5;
P = 1/5 ;
[21]
Example :- 4 Input the Temperature in celsius in Convert Fahrenheit ?
Cout<< “total number is =”<<
Cout<< “percentage is =”<<p ;
Getch ( ) ;
}
#Include<iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Float c,f = 0 ;
Cout<< “please input the temperature in 0C =” ;
Cin>>C ;
F = (9xc)/5+32 ;
Cout<< “the temperature in f0 is =”<<f ;
Getch ( ) ;
}
Formula = c/5
F = (9* c/5)+32
[22]
Example :- 5 :- Input ?
Show ?
Formula :- (Diameter ) = 2r
( Aria ) = ฯ r2
(Parameter ) = 2ฯr
#Include<iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Float r.p.d.a ;
Cout<< “please input redius=” ;
Cin>>r ;
P = 2x3 , 14xr ;
D = 2xr ;
A = 3,14xrxr ;
Cout<< “diameter =”<<d<<endl ;
Cout<< “aria =”<<a<<endl ;
Cout<< “parameter =”<<p ;
Getch ( ) ;
}
[23]
Example :-6:- Write A Programme to Cin And Print The Amount
Principle.
User Principle Use
Show ?
Formula :- P*(1+r/100)h
Power = Value , Po
Power = (2,5)
= 32
#Include<iostream.h>
#Include<conio.h>
#Include<math.h>
Void main ( )
{
Clrsc ( ) ;
Int n, r ;
Float a, p ;
Cout<< “please inter the your and rate =” ;
Cin>>n,r ;
Cout<< “please input the principle amount =” ;
Cin>>p ;
P = Pow { (1+r/100) , n }*p ;
Cout<< “all amount is =”<<a ;
Getch ( ) ;
}
[24]
Example :- 7 :- Input the side of triangle and print the aria of
triangle ?
Input
S = a+b+2/2
Formula :- a = √S * (s-a) * (s-b) * (s-c)
Ex. Variable Shape Change
A = 50 ans a = 90
B = 90 b = 50
CONTROL STATEMENT :- Conditional Function , C++
Condition Check , Condition Perform
:-
1 = If
2 = If ………….else
3 = If…………..else………if
5 = If………………………..else if
6 = ledger if
Example :-8:- It is Check the Condition And Exequite the Result of
Only True Body.
Condition Check , Condition Result Show
Condition True Body Show
Syntax :-
If
(
Condition
)
{
Statement
Statement
}
[25]
Example:-9:- Input the Salary By Any User And check the
Condition. If Salary 5000 than show the Five Percent.Average Print
the Interest and total salary.
2 = If…………..else :- Condition Check ,
Condition True And False Case - Statement Exequte
#Include<iostream.h>
#Include<conio.in>
Void main ( )
{
Clrscr ( ) ;
Int a, i ;
Cout<< “inter your salary =”
Cin>>a ;
If (a > = 5000 )
{
I = ax5/100 ;
I =a+i
Cout<< “total salary =”<<a;
}
Getch ( ) ;
}
[26]
Syntax :-
Ex. Input the mark in two subject and check the maximum Marks,
total marks Average marks pass all Fail when the Average >33%
Pass and Fail.
If ( Condition )
{
True Statement ;
Statement ;
}
Else False
{
Statement ;
Statement ;
}
#Include<iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int m1, m2, t = 0 ;
Float P = 0 ;
Cout<< “please inter the marks in the subject =” ;
Cin>>m1>>m2 ;
T = m1+m2 ;
P = t/2
If (m1>m2)
[27]
Ex. Input the salary of Any worker and check the when salary the >
10000 add the five percentage and Else 3 Percentage?
Salary 10000 3% Percentage Interest
{
Cout<< “the maximum marks is =”<<m1 ;
{
Cout<< “the maximum marks is =”<<m2 ;
}
If ( P > = 33 )
{
Cout<< “pass” ;
}
{
Cout<< “fails” ;
}
Cout<< “total =”<<t<<endl ;
}
Cout<< “average =”<<p ;
Getch ( ) ;
}
#
Include<Io stream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
[28]
Ex 3. If……………else………..if :- If Body Multiple If
Condition Check If Multiple If Nested If
Syntax :-
Int a, i ;
Cout<< “Inter the salary =” ;
Cin i>>a;
If (a > = 10000)
{
True i = ax5/100
A = a+i ; false
{
i = ax3/100
A = a + i ;
}
}
Cout<< “total salary =”<<a<<endl ;
Getch ( ) ;
}
Else
{
If (Condition)
{
Statement ;
Statement ;
}
Else
{
Statement ;
Statement ;
}
[29]
Ex. Input the marks in 3 subject and check the maximum marks
and total and percentage.
If- If P>65 = Frist
P>45 P<60 = Second
P>33 P<45 = Third
P < 33 Fail
Ex. Input the percentage marks by any user and check the Grade.
If :- <33 = Fail
>=33&&<=45=Third
>=45&&<=60=Second
>60&&<=75=Frist
> = Top
Getch ( ) ;
}
#Include<Io stream.h>
#Include<conio.h>
Void main ( )
{
Int P ;
Clrscr ( ) ;
Cout<< “input your percentage value =” ;
Cin>> P ;
If ( P < 33)
{
Cout<< “fail” ;
}
Else
{
If ( P>=33& P<45)
{
[30]
Ex. Input the speed of Car and to Find out how many minutes take
to cross the distance of 500 km.
Car Speed Speed
Formula :- = /
= /
t = d /v
Cout<< “third” ;
}
Else
{
If (P>=45&&P<60)
{
Cout<< “second” ;
}
Else
{
Int a,b,t = 1;
Cout<< “please input the no =” ;
Cin>>a;
For (b=1, b< = 10; b++)
{
Cout<< “t<<”” ;
}}}}}
Getch ( ) ;
}
#Include<Io stream.h>
#Include<conio.h>
Void main ( )
{
Float s,t ;
Clrscr ( ) ;
Cout<< “input the speed =” ;
Cin>>s ;
T = 5000/s ;
Cout<< “time =”<<t ;
Getch ( ) ;
}
[31]
Ex.4 :- ( If………………….Else.If ) Or Ladder If :-
Condition If Statement Check Ladder If
, If Else False Body Use
Ladder Check :-
Syntax :-
LOPING :- Condition Similar Type Statement
Ereoute Looping Statement Use
Looping Statement
1= for 2 = while 3 = do = …………while
If (P<33)
Cout<< “fail” ;
If (P>=33$$P<45)
Cout<< “third” ;
If (P>=45$$P<60)
Cout<< “second” ;
If(P>=60$$P<75)
Cout<< “frist” ;
If(P>75)
Cout<< “top” ;
[32]
1. FOR :- Forloop Esa Initiolezation ( ) Condition ,
Updation Statement Line Check Programme
Body Run
Syntax :-
Ex. Print the all Number Between one two Hundred.
Ex. :- Print the table of Given Number ?
For(Intialization,Condition,Updation)
{
Statement ;
Statement ;
}
#Include<Io stream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
For( int y=1;y<=100;y++)
{
For(int x=1;x<=10;x++)
{
Cout<<x*y<<endl ;
}
}
Getch ( ) ;
}
#Include<Io stream.h>
#Include<conio.h>
Void main ( )
{
Int a,b,t = 1 ;
Clrscr ( ) ;
Cin>>a ;
[33]
Ex. :- 1000 Number Print ****7 Divide
Ex. :- Print the Given Number Is Prime Or Not ?
Number Prime No. ,
Number
For(b = 1 ; b<=10;b++)
{
T = a*b
Cout<<t<< “ ”;
}
Getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
For ( int i=1 ; i<10000 ; i++ )
{
If ( 1%7= = 0)
Cout<<i ;
}
Getch ( ) ;
}
[34]
Ex. :- Value Digit Reverse Value – 276 672
#Include<iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a ;
Cout<< “please inter your no =” ;
Cin>>a ;
For( int b=2 ; b=a/2 ; b++)
{
If ( a%b= = 0)
{
Cout<< “not a prime no =” ;
Break ;
}
}
If (b>a/2)
Cout<< “number is prime =” ;
Getch( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a,b ;
Cout<< “please input the number =” ;
Cin>>a;
For(a ; a>=1 ; a=a/10)
{
B = a % 10 ;
Cout<<b ;
}
Getch ( ) ;
}
[35]
Ex. :- Value No. No.
Ex. :- Value No. Value Number
– 276 7
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a,b,c = 0;
Cout<< “please input the no =” ;
Cin>>a;
For(a ,a>1 ; a=a/10)
{
B = a % 10 ;
C = c+b ;
}
Cout<<c ;
Getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a,b,c = 0;
Cout<< “please input the no =” ;
Cin>>a;
For(a;a>=1;a=a/10)
{
B = a%10 ;
{
C = b ; if ( b>c )
}
Cout
[36]
Question :- Print the Decimal No. Of Given Binary No ?
Decimal No. Binary No. Print ?
NESTED FOR :- For Loop For loop Body
Check Nested For
}
Else
Cout<<c ; cout<<c ;
Getch ( ) ; getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Int a,x = 20, y=10 ;
Cout<< “please enter the number =” ;
Cin>>a ;
For (Int b=a;b>=1;b=b/2)
{
If (b=b/2 = = 0)
{
Goto xy(x,y);(show the result on specitic position )
Cout<<b ;
}
Else
{
Got oxy(x,y) ;
Cout<<b ;
}
x-- ;
}
Getch ( ) ;
}
[37]
Ex. :- Print the table Between 1 - 10
For ( )
{
For ( )
{
Statement ;
Statement ;
}
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( )
For ( int y=1; y<=10; y++)
{
For ( int x=1; x<=10; x++)
{
Cout<<xxy<<endl ;
}
}
Getch ( ) ;
}
[38]
Question :- 1.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Number Print Serial No .
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
For ( int y=1; y<5; y++)
{
For ( int x=1; x<=y; x++)
{
Cout<<endl;
}
Getch ( )
}
[39]
Question :- 2.
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
No Print
Question :- 3.
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
Number Print
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
For ( int y=1; y<=5; y++)
{
For ( int x=1; x<=y; x++)
{
Cout<<y ;
}
Cout<<endl ;
}
Getch ( ) ;
[40]
Question :- 4.
1
1 1
1 1 1
1 1 1 1
1 1 1 1 1
Number Print
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Int P=1;
Clrscr ( ) ;
For (int y=1; y<=5; y++)
{
For (int x=1; x<=y; x++)
{
Cout<<P ;
P++ ;
}
Cout<<endl ;
}
Getch ( ) ;
}
[41]
Question :- 5.
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5
No . Print
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int x,y,p ;
For(x=1; x<=y; x++)
{
Cout<< “1” ;
}
Cout<<endl;
}
Getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int x,y,p ;
For (y=5; y>=1; y--)
{
P = 5 ;
For(x=y; x>=1; x--)
[42]
Question :- 6.
X X X X X
X X X X X
X X X X X
X X X X X
No . Print
{
Cout<<P;
P-- ;
}
Cout<<endl ;
}
Getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int x,y,p=10;
For (y=1; y<=4; y++)
{
For (int s=1; s<=p; s++)
{
Cout<< “ ” ;
}
p--;
Cout<<endl ;
}
Getch ( ) ;
}
[43]
Programme Check :-
Ex .
Ex.
#
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Int P;
For (P=100; P>=100; P=P/7 )
Cout<<P ;
Getch ( ) ;
}
#
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Int P,X,Y=1;
For (P=100; P>=1; P-- )
X = x+2
X ++;
Y ++ ;
X = x-y;
Getch ( ) ;
}
[44]
Ans :- X 1
Question :- Print Asking Chart :-
2. WHILE LOOP :- Looping Statement Condition
Check Statement Execate Loop
Initialization, Condition Updation – Position
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Int X = 1;
Clrscr ( ) ;
For (x=0; x<=255; x++)
{
If (x= = 26)
{
Continue ; - (it creat the continue of looping )
}
Cout<<x<< “ ” ;
}
Getch ( ) ;
}
[45]
Question :- Print the addition of all number Between one two
Hundred ?
Question :- Q Print
Print Function
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Intialization
Int x=1; t=0
While (x<=100)
{
T = t+x;
X++;
}
Cout<<t;
Getch ( );
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int x=1, t=0, s;
While ( x<=100)
{
S = t;
T = t+x;
Cout<< “total of =”<<s<<”+<<x<<+;
X++
}
Getch ( ) ;
}
[46]
Question :- Print the Reverse Order of Hundred to one ?
Question :- Print the total of all odd Number Between Hundred
to One ?
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int x= 100 ;
While ( x> = 1)
{
Cout<<x<< “ ” ;
X - - ;
}
Getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int t, x =100;
While ( x> = 1)
{
If (x % = = 7)
{
T = t+x ;
}
X - - ;
}
Cout<<t ;
Getch ( ) ;
}
[47]
Question :- Print the alphabets A to Z ? ( Capital Letter )
Question :- Print the alphabates A to Z ? ( Small Letter )
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a =1, b;
While (a<=26 )
{
Cout<<char(64+a) ;
A++ ;
}
Getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a =1, b;
While (a<=26 )
{
Cout<<char(64+a)<<char(96+a)<< “ ” ;
A++ ;
}
Getch ( ) ;
}
[48]
Question :- Print the Ascending and Descending Order small
And Capital Alphabets A to Z ?
Question :- Find the Vowel Character in Alphabets ?
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a =1, b;
While (a<=26 )
{
Cout<<char(64+a)<<char(123-a)<< “ ” ;
A++ ;
}
Getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
If (Char(64+a)= = “a”!!char(64+a)= = “e”
!!char(64+a)= = “I”!!char(64+a)= = “d”
!!char(64+a) ;
A++ ;
}
Getch ( ) ;
}
[49]
Question :- Print the decimal No. Into Hexadecimal No ?
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int ( x,y,p=5, I = 10;
Cout<<print input the number =”;
Cin>>x ;
While(x>=1)
{
Y= X % 16
If (y = = 10)
{
Goto xy (Q,P);cout<< “A” ;
}
Else
{
If( y= = 11)
{
Goto xy(Q,P);cout<< “B” ;
}
Else
{
If ( y = = 12)
Goto xy(Q,P);cout<< “C” ;
{
If ( y= = 13)
{
Goto xy(Q,P) ; cout<< “D” ;
}
Else
{
If ( y = = 14 )
{
Goto xy(Q,P);cout<< “E” ;
}
Else
If ( y = = 15)
{
Goto xy(Q,P);cout<< “F”;
[50]
DOO – WHILE…………LOOP :- Loop Condition Check
, Loop Statement Execute Loop
Loop Body Execute Condition Execute
Loop While Semi Colomn
{ Statement ;
............................
………………………………
Statement ;
}
While (condition) ;
Question :- Print the all number Between 100 to 1 ?
}
Else
Goto xy(Q,P);cout<<x;
}}}}}
Q - - ;
Y = x/16;
}
Getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int x=100;
Do
{
Cout<<x<< “ ” ;
X - - ;
}
While (x>=1)
Getch ( ) ;
}
[51]
Question :- Print the addition all given Number By user when the
user press No show the Result ?
Question :- Print the all prime number Between 1 to 100 ?
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int x,t = 0;
Charch = ‘a’ ;
Do
{
Cout<< “please input the number =” ;
Cin>>x ;
T = t+x ;
Cout<< “want to insert the more number =” ;
Ch = getch ( ) ;
}
While (ch!= ‘n’!!ch!= ‘n’ ) ;
Cout<< “result is =”<<t ;
Getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int x=1, y=2, p=0;
For (x=1; x< = 100; x++)
{
P = 0 ;
For( y=2; y<=x/2 ;y++)
{
[52]
SWITCH CASE :- Condition Check ,
Condition According Multiple to show
Switch case is use to any condition and execute the different type to
show ?
Switch ( Condition )
{
Case case 1 : statement ; break ;
Case case 2 : statement ; break ;
Case caee 3 : statement ; break ;
Default
Statement
}
Question :- Print the user choice if user input the input 1 print the
add input 2 print the Equal Input 3 Print the
If (x%y = = 0)
{
P = 1;
Break ;
}
}
If ( P = = 0)
Cout<<x<< “ ” ;
}
Getch ( ) ;
}
#Include<stream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a,b,c ;
Cout<< “input the number a and b=” ;
Cin>>a>>b;
[53]
Question :- Input the week Code when press 1 in print Sunday,
press 2 Monday, Press 3 Tuesday, Press 4 Wednesday , Press 5
Thursday , Press 6 Friday , Press 7 Saturday ?
Cout<< “input your choice=” ;
Cin>>c;
Switch (c)
{
Case1:Cout<<a+b;break ;
Case2:if(a>b) Cout<<a-b;else cout<<b-a;break ;
Case3:cout<<a+b;break;
Case4:if(a>b)cout<<a/b;else cout<<b/a;break;
Default :
Cout<< “wrong choice” ;
}
Getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a ;
Cout<< “enter your choice=” ;
Cin>>a ;
Switch ( a)
{
Case1:cout<< “Sunday”;break;
Case2:cout<< “Monday”;break;
Case3:cout<< “Tuesday”;break;
Case4:cout<< “Wednesday”;break;
Case5:cout<< “Thursday”;break;
Case6:cout<< “Friday”;break;
Case7:cout<< “Saturday”;break;
Default :
Cout<< “wrong choice” ;
}
Getch ( ) ;
}
[54]
Question :- Input any number and input the choice of user if
choice 1 than print the table of Number input2 print the Factorial
input 3 print the Factor input4 print the Loop of No two One ?
#Include<Iostream.h>
#Include<conio.h>
Void main ( ) ;
{
Clrscr ( ) ;
Int a,b,c=1;
Cout<< “please input the number=”;
Cin>>a;
Cout<< “input your choice =” ;
Cin>>b;
Switch ( b )
{
Case1:
For(int n=1; n<=10; n++)
{
Cout<<a+n;
}
Break ;
Case:2
For(int m=1; m<=a; m++)
C =c+m;
Cout<<c;
Break;
Case3:
For(int p=1; p<=4; p++)
{
If ( a% p = = 0)
Cout<<p<< “ ”;
}
Break ;
Case4:
For(int r=a;r>=1;r++)
[55]
ARRAY :- Similar Type Variable Collection
Array Array Element Array Body Declare
Array Body 0 Element Start Element
Value Index ( Element +1 ) Use
Index 1 Start
Element 0 Start
Data Type Array name. [No. of Body ]
Int a [ 5 ]
a [0] a[1] a[2] a[3] a[4]
Rule :- Index = Element+1
Question :- 5 Subject Mark ?
Cout<<r;
Break ;
Default ;
Cout<< “wrong choice” ;
}
Getch ( );
}
A1 A2 A3 A4 A5
[56]
( Print the total of mark in five subject ?)
Question :- 10 – Number Average Print
Subject In Array ?
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a [5], t = 0;
For (int n=0; n<5; n++)
{
Cout<< “please input the number =”<<n+1;
Cin>>a[n];
}
For(n=0; n<5; n++)
{
T = t+a[n];
}
Cout<< “total mark is =”<<t;
Getch ( );
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( );
Int a[10], t=0
For (int x=0; x<10; n++)
Cout<< “please input the number =”<<n+1;
Cin>>a[n];
{
For(n=0; n<10; n++)
{
[57]
Question :- 10 Number Check Ascending Or Descending
Print ? Array
Print the Ascending Or Descending in give 10 Number ? use Array.
T =
t+a [ n ]
}
Cout<<total mark is =”<<t/10;
Getch ( ) ;
}
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a [ 10]
For (int b=0; b<10; b++)
{
Cout<< “input the number =”;
Cin>>a [ b ];
{
Int temp ;
For(int n=0; n<10; n++)
For(int m=n+1; m<10; m++)
{
If(a[n]>a[m])
Temp=a[n];
A [n] =a[m];
A [m] = temp ;
}
}
}
For(int p=0; p<10; p++)
Cout<<a[p]<< “ ”;
Getch ( ) ;
}
[58]
Question :- Print the Maximum and Minimum Number of the
given 50 Number ?
( Number Number Number
? Print
By Array:-
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( );
Int a[50] max=0,min=0;
For(int x=0; x<50; x++
{
Cout<< “please input the number”
Cin>>a [ x ]
}
Max = a[0];
Min = a[0];
For(int x=0; x<50; x++)
{
Cout<< “please input the number<<x-1<<=”;
Cin>>a[x];
}
Max = a[0];
Min = a[0];
For(x=0; a<50;x++)
{
If (a[x]>max)
Max = a[x];
If (a[x]<min)
Min = a[x];
}
Cout<< “max=”<<max;
Cout<< “min=”<<min;
}
[59]
Question :- Input the twenty (20) Number and say the message of
user to find the position of any given number ?
#Include<Iostream.h>
#Include<conio.h>
Void main ( )
{
Clrscr ( ) ;
Int a[20],p;
For (int x=0;x<20;x++)
{
Cout<< “please input the no.”<<x+1<< “=”;
Cin>>a[x];
}
Cout<< “please input the searching no. =”;
Cin>>p;
For(x=0; x<20;x++)
{
If (a[x]= = p)
{
Cout<< “the position of no.” <<x+1;
}
}
If (x>19)
Cout<< “number if not found=”;
Getch ( ) ;
}
The End