multi function calculator confusion.

Ok, so im obviously no c++ god at all as ive posted like 5 codes in the last day or so, but i was wondering why this program wont perform the given operation. here is my 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
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int a,b;
    std::string Operation;
    cout<<"Input two numbers between 1 and 5.\n";
    std::cin >>a>>b;
    cout<<"Input an operation.\n";
    std::cin >>Operation;
    cout<<"The outcome of "<<a<<" "<<Operation<<" "<<b<<" is :\n";
    1;
    2;
   3;
    4;
    5;
    2;
    4;
    6;
   8;
    10;
    3;
    6;
    9;
    12;
    15;
    4;
    8;
   12;
   16;
    20;
    5;
    10;
    15;
    20;
    25;
    system("PAUSE");
    return 0;
}
    
No punch line? What's that thing supposed to do?
i am fairly new to c++, okay, and there is still quite a bit of material ive yet to cover.with this, i am simply experimenting with the c++ possibilities.
it is suppossed to be a calculator, but only with numbers one through five. those numbers
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
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int a,b;
    std::string Operation;
    cout<<"Input two numbers between 1 and 5.\n";
    std::cin >>a>>b;
    cout<<"Input an operation.\n";
    std::cin >>Operation;
    cout<<"The outcome of "<<a<<" "<<Operation<<" "<<b<<" is :\n";
    1;
    2;
   3;
    4;
    5;
    2;
    4;
    6;
   8;
    10;
    3;
    6;
    9;
    12;
    15;
    4;
    8;
   12;
   16;
    20;
    5;
    10;
    15;
    20;
    25;
    system("PAUSE");
    return 0;
}
    

those are all of the possible values that the product or sum, etc. could be. obviously my logic is off, and i need some help.
i think this is what you mean just change the + to */ and -

1
2
3
4
5
if((Operation == '+') && (a <= 5) && (b <= 5))
    {
    cout<<"The outcome of "<<a<<" "<<Operation<<" "<<b<<" is: " << a+b <<endl;
    }
    else
Topic archived. No new replies allowed.