Hello, currently new to C++ and learning the ropes.
I'm trying to create a simple database-like program, but the following code doesn't output any meaningful data. The program compiles fine, though.
The rest of the program is still under work, so I'm just posting the relevant parts which I think are related to the problem:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
//Entering protofunctions first
void UserVerif ();
void UserCreate();
void PayVerif ();
void NameVerif();
void OrderTake ();
void OrderVerif ();
class ProdRecord
{
public:
string name;
float price;
int stock;
ProdRecord(string name, float price, int stock)
{}
};
void OrderTake()
{
int ordertin;
vector<ProdRecord>products;
products.push_back(ProdRecord("Diablo 3", 150.00, 0));
products.push_back(ProdRecord("Call of Duty 5", 150.00, 20));
products.push_back(ProdRecord("Starcraft 3", 150.00, 30));
products.push_back(ProdRecord("Battlefield 4", 150.00, 30));
products.push_back(ProdRecord("Warcraft 4", 150.00, 25));
products.push_back(ProdRecord("Catz 'N Dogz", 50.00, 100));
system("cls");
cout << "Please select your desired product:" << endl;
cout << "1. " << products[0].name << "RM" << products[0].price << "STOCK= " << products[0].stock << endl;
cout << "2. " << products[1].name << "RM" << products[1].price << "STOCK= " << products[1].stock << endl;
cout << "3. " << products[2].name << "RM" << products[2].price << "STOCK= " << products[2].stock << endl;
cout << "4. " << products[3].name << "RM" << products[3].price << "STOCK= " << products[3].stock << endl;
cout << "5. " << products[4].name << "RM" << products[4].price << "STOCK= " << products[4].stock << endl;
cout << "6. " << products[5].name << "RM" << products[5].price << "STOCK= " << products[5].stock << endl;
cout << "Please enter 1-6 for the product of your choice." << endl;
cin >> ordertin;
}
int main()
{
OrderTake ();
system ("pause");
return 0;
}