1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include <iostream>
#include <stdlib.h>
using namespace std;
struct Machine
{
int id[5] = { 100,101,102,103,104 };
string name[5] = {"Lays", "Pepsi","Fanta","Oreo","Sooper" };
float price[5] = { 20,50,50,15,15 };
float quantity[5] = { 10,10,10,10,10 };
};
void compareID()
{
Machine p1;
int ID;
if (ID != p1.id[0] || ID != p1.id[1] || ID != p1.id[2] || ID != p1.id[3] || ID != p1.id[4])
{
cout << "ID not available. Please insert correct ID." << endl;
}
}
int main()
{
Machine p1;
int Rs5coin = 100;
int Rs10coin = 50;
int bill;
cout << "Welcome to Aruba vending machine."<<endl;
cout << "ID Name Price Quantity" << endl;
cout << "100 Lays 20 10" << endl;
cout << "101 Pepsi 50 10" << endl;
cout << "102 Fanta 50 10" << endl;
cout << "103 Oreo 15 10" << endl;
cout << "104 Sooper 15 10" << endl;
cout << "Insert Bill Amount: ";
cin >> bill;
if (bill > 100 || bill < 0)
{
cout << "Wrong bill inserted!!!(must be less than 100 and greater than 0)" << endl;
}
if (bill % 5 != 0 || bill % 10 != 0)
{
cout << "wrong bill inserted!!(must be multiple of 5 or 10)" << endl;
}
}
|