Need Help With My Project

closed account (y6q2y60M)
jmfv
Last edited on
Where did you get this script?
try this...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>

using namespace std;

int main()
{
    cout<<"________________________________________________________________________________";
	cout<<endl;
	cout<<"   ***************** ~~~    THE CALCULATHOR    ~~~ ****************** ";
	cout<<endl;
	cout<<"________________________________________________________________________________";
    cout<<endl;
    
    char op; //(+ - * /)
    int x, y, z;
    
    cout << "Problem:\t";
    cin >> x >> op >> y;
    
    switch(op)
    {
        case '+':
        z = x+y;
        break;
        
        case '-':
        z = x-y;
        break;
        
        case '*':
        z = x*y;
        break;
        
        case '/':
        z = x/y;
        break;
        
        default:
        std::cout << "ERROR!";
    }
    
    cout << x << op << y << " = " << z;
}
Last edited on
last time I show you to initialize variable ch and i !

Here is your code :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <process.h>
#include <stdlib.h>

using namespace std;

void simple(){}
void scientific(){}
void areavolume(){}
void permutation(){}
void combination(){}
void simpleinterest(){}
void compound(){}
void unitcon(){}
void matrix(){}
void at(){}
void datecalc(){}

void main()
{
   system("cls");
   char ch = 0;
   int i = 0;

   const char * thor[] =  
   { 
	  "BASIC_ARITHMATIC" , 
	   "SCIENTIFIC ", 
	   "AREA_&_VOLUME" , 
	   "PERMUTATION ", 
	   "COMBINATION ", 
	   "SIMPLE_INTEREST" , 
	   "COMPOUND_INTEREST" , 
	   "UNIT_CONVERSION" , 
	   "MATRIX_CALCULATIONS" , 
	   "TIME_CALCULATIONS" , 
	   "DATE_CALCULATION" 
   };

   
   void (*calc[])(void) =  
   { 
	   simple , 
	   scientific , 
	   areavolume , 
	   permutation , 
	   combination , 
	   simpleinterest , 
	   compound , 
	   unitcon , 
	   matrix , 
	   at , 
	   datecalc 
   };
   
   
    cout<<"________________________________________________________________________________";
	cout<<endl;
	cout<<"   ***************** ~~~    THE CALCULATHOR    ~~~ ****************** ";
	cout<<endl;
	cout<<"________________________________________________________________________________";
    cout<<endl;
    
   for(int y=0 ; y < 11 ; y++)
      cout<<"\n\t\t\t\t"<< thor[y];

    for(i=0; ch!=27 ; )
    {

      ch=getch();
      if(ch==80)
      {
	     i++;
	     system("cls");
         
		 for (int j = 0; j < 5 ; j++)
		   {
			  if (j == i)
			  {
		        cout<<"\n\t\t\t\t -->"<< thor[j] ;
			  }
			  
			  else
			  {
				  // you did not create this array !!!!
				// cout<<"\n\t\t\t\t"<< myarray[j];
			  }
	       }

         ch=getch();
         
		 if(ch == 13)
	     cout<<"\n\n\t\t\t"<<calc[i];
      }
	    
	  else if(ch == 72)
      {
         i--;
         system("cls");
         
		 for (int j = 0 ; j < 5 ; j++)
		   {
			  if (j == i)
			  {
                  cout<<"\n\t\t\t\t --> "<< thor[j]; 
			  }
			  else
			  {
                  cout<<"\n\t\t\t\t"<< thor[j];
			  }
		   }

         ch=getch();
         
		 if(ch==13)
	     cout<<"\n\n\t\t\t"<<calc[i];
      }


   }
	system("pause");

}
closed account (y6q2y60M)
@firecoder

i made it by my own
Topic archived. No new replies allowed.