Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //main() to call other functions
- #include <stdio.h>//standard input output functions
- #include <stdlib.h>//for sxit() and clrscr()?
- #include <conio.h>// for consol input output functions
- #include <stdbool.h>//
- #include "calc.h"//local header file
- //start of main()
- int main(void){
- char C;//declaration
- float a, b;//variables for manipulation
- clrscr();//clearing screen
- //start of do-while loop
- do {
- puts("Enter first number:");//prompt
- input(a);//valid input; first variable
- clrscr();//clearing screen
- puts("Enter second number:");//promopt
- input(b);//valid input; second variable
- clrscr();//clearing screen
- menu();//printing menu
- C=getchar();//input/getting choice
- //start of switch
- switch (C)
- {
- case 1:
- addition(a,b);//two variable addition
- break;
- case 2:
- substraction(a,b);//two variable substraction
- break;
- case 3:
- multiplication(a,b);//two variable multiplication
- break;
- case 4:
- division(a,b);//two variable division
- break;
- case 'e':
- exit(0);//exiting program
- break;
- case 'E':
- exit(0);//exiting program
- break;
- default:
- puts("Invalid Entry, Press Enter to continue...");//message and prompt
- C='x';
- getch();//input
- break;
- }//end of switch
- } while(C=='x');//end of do-while loop
- }//end of main()
Add Comment
Please, Sign In to add comment