Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> //for cout
- #include <stdio.h> //for fopen
- #include "shell.h"
- using namespace std;
- int filevar;
- //float x,y;
- int main()
- {
- //cout << "Enter value for x & y:\n" ;
- //cout << "x="; cin >> x;
- //cout << "y="; cin >> y;
- shell();
- FILE * pFile;
- pFile=fopen ("default-rule.txt","r");
- if (pFile==NULL) perror ("Error opening file");
- else {
- do {
- filevar = fgetc (pFile);
- switch (filevar)
- {
- case 'a': cout << "x+y=" << x+y << "\n"; break;
- case 's': cout << "x-y=" << x-y << "\n"; break;
- case 'q': cout << "x*y=" << x*y << "\n"; break;
- case 'd': cout << "x/y=" << x/y << "\n"; break;
- };
- } while (filevar != EOF);
- fclose (pFile);
- };
- return 0;
- }
Add Comment
Please, Sign In to add comment