Hey. I get bored so muck around with c++ and i have made this:
/* My shop program*/
#include <iostream>
#include <fstream>
#include <conio.h>
#include <time.h>
using namespace std;
int main()
{
double quantity;
unsigned int itemNo;
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
ofstream myfile;
cout << "Please enter the item number : ";
cin >> itemNo;
switch(itemNo)
{
case '0100':
cout << endl << "Quantity? : ";
cin >> quantity;
cout << 0.5 * quantity;
myfile.open ("shop.txt", ios::ate | ios::app);
myfile << itemNo << " * " << quantity << asctime (timeinfo);
myfile.close();
break;
}
getch();
}
It all compiles fine, and everything but i get a [WARNING] multi-character character constant.
What happens is the program executes and displays "Please enter the item number : " so i enter the number and then press enter but then i think getch(); is executed, can someone help me with this little mistake, thanks.