I'm new to programming and I'm trying to change this code to write it to a text file. Basically I have to find the price of an item that was stored in the array 'List', each pointer contains an item code, description, price and discount. I'm having two problems though, finding the item's price in the text file and than changing it by the user's input. Any help would be brilliant
void DoSetItemPrice(void) {
int `searchCode` = 0;
double changePrice = 0.00;
cout << "Enter Code For Search: ";
cin >> searchCode;
cout << endl;
cout << "Enter Price Change: $";
cin >> changePrice;
cout << endl;
for (int i = 0; i < numItems; i++)
{
if (List[i].HasCode(searchCode) == true)
{
List[i].SetPrice(changePrice);
cout << "New Price: $" << List[i].GetDiscount();
} else
cout << "The Code You Entered Could Not Be Found";
}
}
Aucun commentaire:
Enregistrer un commentaire