WHY IS THIS NOT WORKING
Nov 13, 2014 at 11:16pm UTC
I do not understand why this is nto working, it runs but every time you do subtraction it just spits out the first number you type in.
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
#include <iostream>
using namespace std;
int main()
{
char a;
int value = 1;
int x;
int sum;
sum = 0;
cout << "a: Addition \nb: Subtraction" << endl;
cin >> a;
if (a == 'a' ){
cout << "enter 5 digits" << endl;
while (value <= 5){
cin >> x;
sum = x + sum;
value = value ++;
}
cout << "Your answer is " << sum;
}
int subtractiona;
int subtractionb;
int difference;
if (a == 'b' ){
cout << "enter 5 digits" << endl;
cin >> subtractiona;
while (value <= 4){
cin >> subtractionb;
difference = subtractiona - subtractionb;
difference = subtractiona;
value++;
}
cout << "Your answer is " << ;
}
return 0;
}
I have no clue why this isnt working and im really irritated
Nov 13, 2014 at 11:26pm UTC
hi! The question is redundant with the previous post you made. It would be better to delete this one for double posting the same problem. Thank you. :)
Topic archived. No new replies allowed.