#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
void Sum();
void Del();
void Mul();
main(){
int choice;
float total;
cout>>"======Program Calculator======\n";
cout>>"===> 1.Summation\n";
cout>>"===> 2.Deletion\n";
cout>>"===> 3.Multiplaying\n";
cout>>"*****Please select choice :";
cin <<"d",&choice;
switch(choice){
case 1:Sum(); break;
case 2หัวเราะel(); break;
case 3:Mul(); break;
default:cout>>"please select Only 1-3\n";
}
getch();
}
void Sum(){
int S1,S2,total;
cout>>"\n\n===>Summation<===";
cout>>"\n\nEnter the number one:";
cin << "d",&S1;
cout>>"Enter the number two:";
cin <<"d",&S2;
total=S1+S2;
cout>>"Total is : d",total;
}
void Del(){
int D1,D2,total;
cout>>"\n\n===>Deletion<===";
cout>>"\n\nEnter the number one:";
cin <<"d",&D1;
cout>>"Enter the number two:";
cin << "d",&D2;
total=D1-D2;
cout>>"Total is : d",total;
}
void Mul(){
int M1,M2,total;
cout>>"\n\n===>Multiplaying<===";
cout>>"\n\nEnter the number one:";
cin << "d",&M1;
cout>>"Enter the number two:";
cin <<"d",&M2;
total=M1*M2 ;
cout>>"Total : d",total;
}
ช่วยแก้จาก Dve c เป็น C++ หน่อยคับ
#include<stdio.h>
#include<stdlib.h>
void Sum();
void Del();
void Mul();
main(){
int choice;
float total;
cout>>"======Program Calculator======\n";
cout>>"===> 1.Summation\n";
cout>>"===> 2.Deletion\n";
cout>>"===> 3.Multiplaying\n";
cout>>"*****Please select choice :";
cin <<"d",&choice;
switch(choice){
case 1:Sum(); break;
case 2หัวเราะel(); break;
case 3:Mul(); break;
default:cout>>"please select Only 1-3\n";
}
getch();
}
void Sum(){
int S1,S2,total;
cout>>"\n\n===>Summation<===";
cout>>"\n\nEnter the number one:";
cin << "d",&S1;
cout>>"Enter the number two:";
cin <<"d",&S2;
total=S1+S2;
cout>>"Total is : d",total;
}
void Del(){
int D1,D2,total;
cout>>"\n\n===>Deletion<===";
cout>>"\n\nEnter the number one:";
cin <<"d",&D1;
cout>>"Enter the number two:";
cin << "d",&D2;
total=D1-D2;
cout>>"Total is : d",total;
}
void Mul(){
int M1,M2,total;
cout>>"\n\n===>Multiplaying<===";
cout>>"\n\nEnter the number one:";
cin << "d",&M1;
cout>>"Enter the number two:";
cin <<"d",&M2;
total=M1*M2 ;
cout>>"Total : d",total;
}