#include
#include
#include
void main()
{
int ch4;
do
{
clrscr();
cout<<"\n Program By : pratya wutticho "<
cin>>ch4;
switch(ch4)
{
case 1 :
int i44;
clrscr();
for(i44=1;i44>=5;i44++)//set iniatial i value and condition of for loop
cout<<"Program C++\n";
getch();cout<<'\n';
//condition with decrease value i=i-1
for(i44=5;i44>=1;i44--)
cout<<"I love C++ language\n";
getch();cout<<'\n';
for(i44=16;i44<=20;i44++)
cout<<"C++ language is very easy for me \n" ;
getch();
break;
case 2 :
float average44,i41,summation44;
//begin statement
clrscr();
summation44=0;
average44=0;
//set initial value
cout<<"Progarm display summation and average 1-10\n";
for(i41=1;i41<=10;i41++)
{cout<
}
average44=summation44/10;
cout<<"\n Summation 1-10="<
break;
case 3 :
float i42,summation42,n42;
float average42;
//begin statement
clrscr();
summation42=0;average42=0; //set initial value
cout<<"Program display summation and average 1-n\n";
cout<<"Please enter n : ";
cin>>n42;
for(i42=1;i42<=n42;i42++);
{
cout<
}
average42=summation42/n42;
cout<<"\nSummation 1-10 = "<
break;
case 4 :
int i43,j43;
//begin statement
clrscr();
cout<<"Display Multiply calculation :\n";
for(i43=2;i43<=4;i43++)//begin external loop
{
cout<<"Display Multiply calculation of "<
{
cout<
}//end of internal loop
cout<<"press any key to continue...";
getch();
}//end of external loop
cout<<"\nEnd of Program....\a\n";
getch();
break;
case 5 :
int i45;
clrscr();
i45=1;//set initial of veriable in shile conditio
while(i45<=5)
{
cout<<"I love C++Langauge\n";
i45++;//increase veriable value
}
getch();
break;
case 6 :
char ch44;
int count46;
//begin statement
clrscr();
count46 = 0;
cout<<"Please enter character : \n";
while (ch44!='8'&& ch44!='*'&&ch44!='a')
{
cin>>ch44; //enter character from keyboard
count46++; //count of timers that enter character
}
cout<<"Character"<
break;
case 7 :
float number47,sum47,average47;
//begin statement
clrscr();
cout<<"Program calculate summation and average 1-10\n";
sum47=0; average47=0; number47=1;
while (number47<=10)//begin loop
{
cout<
number47++;//increase variable+1
}//end loop
average47=sum47/(number47-1);
cout<<"\nSummation number 1-10 = "<
break;
case 8 :
int i48;
clrscr();
i48=1;//set initial of variable in do...while condiyion // begin loop
do
{
cout<<"I love C++ langauge \n";
i48++; //increase value of i variable+1
}while(i48<=5);//condition for loop
getch();
case 9 :
float number49,sum49,average49;
//begin statment
clrscr();
cout<<"Program claculate summation and average 1-10" ;
sum49=0;average49=0;number49=1;
do
{
cout<
number49++;
}while(number49<=10);
average49=sum49/(number49-1) ;
cout<<"\n Summation numbre 1-10=" <
getch();
break;
case 10:
int x410,row410,sum410;
clrscr();
row410=0;sum410=0;
for(x410=1;x410<=100;++x410)//condition for 100 loop
{
cout<<"x = "<
row410++;
if(row410>23)//condition of break
break;
}
cout<<"summation 1-"<
break;
case 11:
float x411,y411;
char choice411;
do
{
clrscr();
cout<<"\nProgram Divide Calculation x/y";
cout<<"\n**********************************";
cout<<"\nEnter X : ";
cin>>x411;
cout<<"\nEnter Y : ";
cin>>y411;
if(y411==0)
{
cout<<"\a\n\nCan't divide by aero !!!";
cout<<"\npress any key to continue...";
getch();
continue;//return to begin loop
}
cout<<"\n***Result "<
cin>>choice411;
}
while((choice411!='n')&&(choice411!='N'));
clrscr();
break;
}//end of do...while
}//end of switch
while(ch4!=0);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น