ChaturBauka

main.c

Jan 8th, 2019
50
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //main() to call other functions
  2. #include <stdio.h>//standard input output functions
  3. #include <stdlib.h>//for sxit() and clrscr()?
  4. #include <conio.h>// for consol input output functions
  5. #include <stdbool.h>//
  6. #include "calc.h"//local header file
  7. //start of main()
  8. int main(void){
  9.   char C;//declaration
  10.   float a, b;//variables for manipulation
  11.   clrscr();//clearing screen
  12.   //start of do-while loop
  13.   do {
  14.     puts("Enter first number:");//prompt
  15.     input(a);//valid input; first variable
  16.     clrscr();//clearing screen
  17.     puts("Enter second number:");//promopt
  18.     input(b);//valid input; second variable
  19.     clrscr();//clearing screen
  20.     menu();//printing menu
  21.     C=getchar();//input/getting choice
  22.     //start of switch
  23.     switch (C)
  24.     {
  25.       case 1:
  26.       addition(a,b);//two variable addition
  27.       break;
  28.       case 2:
  29.       substraction(a,b);//two variable substraction
  30.       break;
  31.       case 3:
  32.       multiplication(a,b);//two variable multiplication
  33.       break;
  34.       case 4:
  35.       division(a,b);//two variable division
  36.       break;
  37.       case 'e':
  38.       exit(0);//exiting program
  39.       break;
  40.       case 'E':
  41.       exit(0);//exiting program
  42.       break;
  43.       default:
  44.       puts("Invalid Entry, Press Enter to continue...");//message and prompt
  45.       C='x';
  46.       getch();//input
  47.       break;
  48.     }//end of switch
  49.   } while(C=='x');//end of do-while loop
  50. }//end of main()
RAW Paste Data