Hi there. I'm trying to make a program that loads a value from a file (starting from 0 ) and adds a number each time.
i.e. I have a file "data.log" that contains 0 , after the first run I add 100 so now it contains 100, then I add 50 , and it contains 150 and so on.
The problem is: 4 lines before the end
using namespace std;
int MyScore = 0 , i = 0;
char Temp = '0', c = '0';
my_file.open("data.log", ios::out | ios::in);
if( my_file) cout <<"found"<<endl;
else cout <<"not found"<<endl;
// LOADING FROM FILE
gputs("How much completed?:\na. 1/3\nb. 1/2\nc. 1\n ans = ");
c = cin.get();
case 'a': MyScore += 50; break;
case 'b': MyScore += 75; break;
case 'c': MyScore +=100; break;
default : break;
MyScore += Temp - '0';
my_file<<"My Score is :"<<MyScore<<endl;
doesn't work as it should
Do you have any idea why?