Help me please noob here.

Help me include fstream here in my code i'm a newbie in programming.

#include <iostream>
#include <windows.h>
#include <conio.h>
#include <limits>
using namespace std;
int numorder, total, wallright, premium, excel, x;
int main ()
{
int choice;
char username[]="charles";
char password[]="pass";
char uname[20];
char pass[20];
bool account=false;
wallright = 193;
x=220;
char y , n, answer;
premium = 300;
excel = 250;
int cnt=0;

while(1){
system("color 70");
system("cls");
printf("USERNAME: ");
cin >> uname;

cout << "PASSWORD: ";
int i=0;
while(1)
{
pass[i]=getch();
if(pass[i]==13)
{
pass[i]='\0';
break;
}
cout << "*";
i++;
}

if(!strcmp(uname,username) && !strcmp(pass,password)) {
account=true;
break;
}

else

{
cnt++;
if(cnt==3)
break;
cout << "\nIncorrect username or password\n";
cout << "No of try: "<<cnt <<endl;
system("pause");

}
}
if(account)

{
cout << "\n\nAccess Granted!";
Sleep(2000);
system("cls");
{
numericinput:
cout<< "Welcome to Holcim's Cement Ordering System ";
cout<< endl;
cout<< endl;
cout<< endl;
cout<< endl;
cout<< "1. Holcim Wallright Cement----- Php 193.00 per bag ";
cout<< endl;
cout<< endl;
cout<< "2. Holcim Premium Cement----- Php 300.00 per bag";
cout<< endl;
cout<< endl;
cout<< "3. Holcim Excel Cement----- Php 200.00 per bag";
cout<< endl;
cout<< endl;
cout<< "4. Holcim 4x----- Php 220.00 per bag";
cout<< endl;
cout<< endl;
cout<< "Enter The number of the type of cement of your choice: ";
cin>> choice;

cout<< "Loading...";
Sleep (2000);
system("cls");
}
switch(choice)
{

case 1:
cout<< "You have chose Holcim Wallright Cement!";
cout<< endl;
cout<< endl;
orderulit:
cout<< "How many Bags would you like to order?";
cout<< endl;
cout<< endl;
cout<< "Number of Bags: ";
cin>> numorder;
if(! (cin>> choice))
{
cout<< "Sorry your choice is not invalid. Please Input a valid answer."<< endl;
Sleep(2000);
system("cls");
cin.clear();
cin.get( numeric_limits<streamsize>::max());
goto orderulit;
}


total = numorder * wallright;
cout<< "Calculating Total Price...Please Wait...";
Sleep(2000);
cout<< "Total Price: Php "<< total;
cout<< endl;
cout<< endl;
cout<< "Thank you for using Holcim's Ordering System!";
cout<< endl;
cout<< endl;

break;

case 2:
cout<< "You have chose Holcim Premium Cement!";
cout<< endl;
cout<< endl;
orderulitt:
cout<< "How many Bags would you like to order?";
cout<< endl;
cout<< endl;
cout<< "Number of Bags: ";
cin>> numorder;
if(! (cin>> choice))
{
cout<< "Sorry your choice is not invalid. Please Input a valid answer."<< endl;
Sleep(2000);
system("cls");
cin.clear();
cin.ignore( numeric_limits<streamsize>::max(),'\n');
cin.clear();
goto orderulitt;
}
total = numorder * wallright;
cout<< "Calculating Total Price...Please Wait...";
Sleep(2000);
cout<< "Total Price: Php "<< total;
cout<< endl;
cout<< endl;

break;

case 3:
cout<< "You have chose Holcim Excel Cement!";
cout<< endl;
cout<< endl;
orderulittt:
{

cout<< "How many Bags would you like to order?";
cout<< endl;
cout<< endl;
cout<< "Number of Bags: ";
cin>> numorder;
if(! (cin>> choice))
{
cout<< "Sorry your choice is not invalid. Please Input a valid answer."<< endl;
Sleep(2000);
system("cls");
cin.clear();
cin.ignore( numeric_limits<streamsize>::max(),'\n');
cin.clear();
goto orderulittt;
}

total = numorder * wallright;
cout<< "Calculating Total Price...Please Wait...";
Sleep(2000);
cout<< "Total Price: Php "<< total;
cout<< endl;
cout<< endl;
cout<< "Thank you for using Holcim's Ordering System!";
cout<< endl;
cout<< endl;

break;

case 4:
cout<< "You have chose Holcim 4x Cement!";
cout<< endl;
cout<< endl;
orderulitttt:
cout<< "How many Bags would you like to order?";
cout<< endl;
cout<< endl;
cout<< "Number of Bags: ";
cin>> numorder;
if(! (cin>> choice))
{
cout<< "Sorry your choice is not invalid. Please Input a valid answer."<< endl;
Sleep(2000);
system("cls");
cin.clear();
cin.ignore( numeric_limits<streamsize>::max(),'\n');
cin.clear();
goto orderulitttt;
}
total = numorder * wallright;
cout<< "Calculating Total Price...Please Wait...";
Sleep(2000);
cout<< "Total Price: Php "<< total;
cout<< endl;
cout<< endl;
cout<< "Thank you for using Holcim's Ordering System!";
cout<< endl;
cout<< endl;

break;


default:

if(! (cin>> choice)){
cout<< "Sorry your choice is not available. Please Input a valid answer."<< endl;
cin.clear();
cin.ignore( numeric_limits<streamsize>::max(),'\n');
cin.clear();
goto numericinput;
}
else{
cout<< "Sorry your choice is not available. Please Input a valid answer."<< endl;
cout<< endl;
cout<< "Please what you have entered to confirm: ";
cout<< endl;
goto numericinput;
}
}
}
}
else
{
cout << "\n\nIncorrect input 3 times";
}

system("pause>0");
return 0;
}

Topic archived. No new replies allowed.