Well I just finished the basic V1.0 version of my program using all the infomation I had. I compiled the program and then I ran it, 3 seconds later a window pops up and says the program has crashed anyone know why? here my source...
Code:
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
//prototype funtion
void Showinfo();
void GetInfo();
void DisplayResaults();
//Call Arrays
float ItemPrice[128];
char ItemName[10];
void Showinfo()
{
cout << "The KrustyCrab Cash Register.\n "
<< "Last Updated: September 9th 2003\n\n"
<< "Intructions:\n"
<< "Fisrt Enterin A Product name. Then the Price of that product.\n"
<< "Then when the customer doesent whant anymore products type done for the name. And see the list of products and there prices then the total price.\n\n";
GetInfo();
}
void GetInfo()
{
int i;
int t;
std::string ItemName[10];
cout << "Enter in a product name: ";
std::getline(std::cin, ItemName[t]);
std::cout<<"Product Name: "<< ItemName<<std::endl;
cout << "Enter in the price: $";
cin >> ItemPrice[i];
i++;
t++;
while (std::getline(std::cin, ItemName[t]) && ItemName[t] != "done")
{
DisplayResaults();
}
}
void DisplayResaults()
{
cout << "Product1:"<< ItemName[0]<< "\n"<< "Product1 Price: $"<< ItemPrice[0]<< "\n"
<< "Product2:"<< ItemName[1]<< "\n"<< "Product2 Price: $"<< ItemPrice[1]<< "\n"
<< "Product3:"<< ItemName[2]<< "\n"<< "Product3 Price: $"<< ItemPrice[2]<<"\n"
<< "Product4:"<< ItemName[3]<< "\n"<< "Product4 Price: $"<< ItemPrice[3]<<"\n"
<< "Product5:"<< ItemName[4]<< "\n"<< "Product5 Price: $"<< ItemPrice[4]<<"\n"
<< "Product6:"<< ItemName[5]<< "\n"<< "Product6 Price: $"<< ItemPrice[5]<<"\n"
<< "Product7:"<< ItemName[6]<< "\n"<< "Product7 Price: $"<< ItemPrice[6]<<"\n"
<< "Product8:"<< ItemName[7]<< "\n"<< "Product8 Price: $"<< ItemPrice[7]<<"\n"
<< "Product9:"<< ItemName[8]<< "\n"<< "Product9 Price: $"<< ItemPrice[8]<<"\n"
<< "Product10:"<< ItemName[9]<< "\n"<< "Product10 Price: $"<< ItemPrice[9]<<"\n";
}
int main()
{
Showinfo();
system("pause");
return 0;
}
Thanks for your help...
~StormTrooper