Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int size_a, size_b;
- double a = 0, b = 0;
- int intresult = 0;
- double dubresult = 0;
- char operation;
- char in_type[15];
- int current = 0;
- int status;
- char * la;
- char * lb;
- printf("\nWrite the type of input data ");
- scanf("%6s", in_type);
- //
- if (!strcmp(in_type, "string"))
- {
- current = -1;
- printf("Enter max size of line a ");
- scanf("%d", &size_a);
- la = new char[size_a];
- printf("Enter line a = ");
- scanf("%s", la);
- printf("\nEnter the operation ");
- fflush(stdin);
- operation = getchar();
- printf("Enter max size of line b ");
- scanf("%d", &size_b);
- lb = new char[size_b];
- printf("\nEnter line b = ");
- scanf("%s", lb);
- check_string_operation(in_type,operation, la, lb, size_a, size_b);
- getch();
- return 0;
- }
- else
- {
- printf("Enter a = ");
- status = scanf("%lf", &a);
- printf("\nEnter the operation ");
- fflush(stdin);
- operation = getchar();
- //if (operation == 10)
- // operation = getchar();
- //
- printf("\nEnter b = ");
- scanf("%lf", &b);
- }
- switch (operation)
- {
- case '+':
- {
- current = 0;
- check_casual_operation(in_type, current, dubresult, intresult, a, b);
- break;
- }
- case '*':
- {
- current = 1;
- check_casual_operation(in_type, current, dubresult, intresult, a, b);
- break;
- }
- case '-':
- {
- current = 2;
- check_casual_operation(in_type, current, dubresult, intresult, a, b);
- break;
- }
- case '/':
- {
- current = 3;
- check_div_operation(in_type, current, dubresult, intresult, a, b);
- break;
- }
- }
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement