ช่วยดูให้ผมหน่อยนะครับว่า เครื่องหมาย } ตัวไหนเป็นเครื่องหมายสุดท้ายของโปรแกรมครับ ส่งครูพรุ่งนี้ T-T
#include <iostream.h>
#include <conio.h>
float Circle();
float Square();
float Triangle();
int Radius,Width,Long,Base,High;
void main()
{
char choice;
do{
clrscr();
cout<<"Program Calcurate Area\n";
cout<<"1. Circle\n";
cout<<"2. Square\n";
cout<<"3. Triangle\n";
cout<<"0. Exit\n";
cout<<"Please select your choice <1-3>: ";
cin>>choice;
switch(choice)
{
case '1':
cout<<"\nYou select choice "<<choice<< " calculate Circle Area\n";
cout<<"Enter Radius :";cin>>Radius;
cout<<"Circle Area : "<<Circle();
cout<<"\nPress any key to end program";
break;
case '2':
cout<<"\nYou select choice "<<choice<< " calculate Square Area\n";
cout<<"Enter Width :";cin>>Width;
cout<<"Enter Long :";cin>>Long;
cout<<"Squara Area : "<<Square();
cout<<"\nPress any key to end program";
break;
case '3':
cout<<"\nYou select choice "<<choice<< " calculate Triangle Area\n";
cout<<"Enter Base :";cin>>Base;
cout<<"Enter High :";cin>>High;
cout<<"Triangle Area : "<<Triangle();
cout<<"\nPress any key to end program";
break;
case '0':
cout<<"Exit\n";
break;
}
getch();
}
while(choice!='0');
}
float Circle()
{float Area;Area=3.14*Radius*Radius;
return (Area);}
float Square()
{float Area;Area=Width*Long;
return (Area);}
float Triangle()
{float Area;Area=0.5*Base*High;
return (Area);}
ช่วยดูโค้ดนี้ให้ผมหน่อยนะครับ
#include <iostream.h>
#include <conio.h>
float Circle();
float Square();
float Triangle();
int Radius,Width,Long,Base,High;
void main()
{
char choice;
do{
clrscr();
cout<<"Program Calcurate Area\n";
cout<<"1. Circle\n";
cout<<"2. Square\n";
cout<<"3. Triangle\n";
cout<<"0. Exit\n";
cout<<"Please select your choice <1-3>: ";
cin>>choice;
switch(choice)
{
case '1':
cout<<"\nYou select choice "<<choice<< " calculate Circle Area\n";
cout<<"Enter Radius :";cin>>Radius;
cout<<"Circle Area : "<<Circle();
cout<<"\nPress any key to end program";
break;
case '2':
cout<<"\nYou select choice "<<choice<< " calculate Square Area\n";
cout<<"Enter Width :";cin>>Width;
cout<<"Enter Long :";cin>>Long;
cout<<"Squara Area : "<<Square();
cout<<"\nPress any key to end program";
break;
case '3':
cout<<"\nYou select choice "<<choice<< " calculate Triangle Area\n";
cout<<"Enter Base :";cin>>Base;
cout<<"Enter High :";cin>>High;
cout<<"Triangle Area : "<<Triangle();
cout<<"\nPress any key to end program";
break;
case '0':
cout<<"Exit\n";
break;
}
getch();
}
while(choice!='0');
}
float Circle()
{float Area;Area=3.14*Radius*Radius;
return (Area);}
float Square()
{float Area;Area=Width*Long;
return (Area);}
float Triangle()
{float Area;Area=0.5*Base*High;
return (Area);}