#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
void Sum();
void Del();
void Mul();
main(){
int choice;
float total;
printf("======Program Calculator======\n");
printf("===> 1.Summation\n");
printf("===> 2.Deletion\n");
printf("===> 3.Multiplaying\n");
printf("*****Please select choice :");
scanf("%d",&choice);
switch(choice){
case 1:Sum(); break;
case 2

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