Creating a basic Inventory Question

Hey everyone out there, Ive been reading several posts and part of this page for about a month now, and I created this account in order to find some help.
I am creatiing a basic inventory that has 3 functions, Add a new Item, View Inventory, and to consult price (The difference from this one to View inventory is that I want to show 3 variables Product Name, Wholesale Cost and Retail Price when the name is inputed). So Ive been working with switches and cases because that is my approach, but ive been told that I should use arrays, some functions or classes in order to make this work, but I don´t now where to start. I know that I require the <fstream> library in order to save and show data on a .txt file.


#include <iostream>
#include <string>
#include <fstream>


using namespace std;

int main ()
{
double additem,wholesale_c,retail_c;
int x;
char y;
char name[12];

do {

cout <<"~~~~~~~~~~~~~~~~~~~~~~\nInventory Program\n~~~~~~~~~~~~~~~~~~~~~~" <<endl <<endl <<endl;


cout <<" Choose an option" <<endl;
cout <<" 1.Add Item" <<endl;
cout <<" 2.View Inventory" <<endl;
cout <<" 3.View Price" <<endl;
cin >> x;

while (x<1 || x>3)
{
cout <<"Please choose a valid option 1-3" <<endl;
cin>> x;
system("cls");
}

do {
switch (x) {

case 1:
cout <<"\nType product name\n" <<endl;
cin >> name;
cout <<"\nType in Wholesale cost\n" <<endl;
cin >> wholesale_c;
cout <<"\nType in Retail Price\n" <<endl;
cin >> retail_c;
cout <<"\nData Saved. Would you like to add another item? (y/n)" <<endl;

//I know the data isnt saved, but i would like to know what to do to make it work, because of this I dont have any other cases for the remaining options :/

cin >> y;
system("cls");
break;



}

}
while (y=='y');

}
while (y=='n');

system("pause");

}
Topic archived. No new replies allowed.