Makakuha ng detalyadong mga sagot sa lahat ng iyong tanong sa IDNStudy.com. Hanapin ang impormasyon na kailangan mo nang mabilis at madali sa pamamagitan ng aming komprehensibo at eksaktong platform ng tanong at sagot.

how can i make a c++ program that can perform addition, subtraction, multiplication and division of five numbers


Sagot :

i like scripting you can use this source code 
/* Source code to create a simple calculator for addition, subtraction, multiplication and division using switch...case statement in C programming. */ # include <stdio.h> int main() { char operator; float num1,num2; printf("Enter operator either + or - or * or divide : "); scanf("%c",&operator); printf("Enter two operands: "); scanf("%f%f",&num1,&num2); switch(operator) { case '+': printf("num1+num2=%.2f",num1+num2); break; case '-': printf("num1-num2=%.2f",num1-num2); break; case '*': printf("num1*num2=%.2f",num1*num2); break; case '/': printf("num2/num1 = %.2f",num1/num2); break; default: /* If operator is other than +, -, * or /, error message is shown */ printf("Error! operator is not correct"); break; } return 0; }

Enter operator either + or - or * or divide: / Enter two operands: 13.456 4.56 num2/num1 = 2.95