Need some help
Sep 18, 2013 at 3:17am UTC
Can't compile it because of line 66 and 67, I think I need to declare it but don't know what to do. Also another problem it says "In function 'int main()': can someone point a right direction for me?
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
#include <iostream> // needed
#include <iomanip> // for setw()
#include <string> // for string
using namespace std;
int main ()
{
int UPC1, quantity1, choice;
double price1, tValue1;
int UPC2, quantity2;
double price2, tvalue2;
//strings
string man1= "Manufacture" ;
int size = man1.length ();
string product1 = "Product" ;
string man2 = "Manufacture" ;
string product2 = "Product" ;
int x = -1;
const int DISPLAY_CHOICE = 1,
EDIT_CHOICE = 2,
RESET_CHOICE = 3,
EXIT_CHOICE = 4;
cout << "1. Display products\n"
<< "2. Edit product\n"
<< "3. Reset Product to Default\n"
<< "4. Exit\n"
<< "Please enter your choice: " ;
cin >> choice;
int display;
cout << setprecision (2) << fixed << showpoint;
if (choice == 1)
{
cout << "Display either product 1 or product 2? Enter 1 or 2 " << endl;
cin >> display;
if (display == 1)
{
cout << "Product 1" << endl;
cout << setw (0) << " UPC: " << setw(11) << UPC1 << endl;
cout << setw (0) << " Manufacturer: " << setw(5) << man1 << endl;
cout << setw (0) << " Product Name: " << setw(5) << product1 << endl;
cout << setw (0) << " Price: $" << setw (0) << price1 << endl;
cout << setw (0) << " Quantity: " << setw (5) << quantity1 << endl;
cout << setw (0) << " Total Value: $" << setw (0) << tValue1 << endl;
}
else if (display == 2)
{
cout << "Product 2" << endl;
cout << setw (0) << " UPC: " << setw (11) << UPC2 << endl;
cout << setw (0) << " Manufacturer: " << setw (5) << man2 << endl;
cout << setw (0) << " Product Name: " << setw (5) << product2 << endl;
cout << setw (0) << " Price: $" << setw (0) << price2 << endl;
cout << setw (0) << " Quantity: " << setw (5) << quantity2 < endl;
cout << setw (0) << " Total Value: $" << setw (0) << tValue2 << endl;
}
if (display == 1)
{
cout << "Enter the Universal Product Code1." << endl; cin >> UPC1;
cout << "Enter manufacturer1." << endl;
cin >> man1;
cout << "Enter the name of product1." << endl;
cin >> product1;
cout << "Enter price1." << endl;
cin >> price1;
cout << "Enter quantity1." << endl;
cin >> quantity1;
}
if (choice == 2)
{
cout << "Edit either product1 or product2? Enter 1 or 2." << endl;
cin >> display;
}
else if (display == 2)
{
cout << "Enter the Universal Product Code2." << endl;
cin >> UPC2;
cout << "Enter manufacturer2." << endl;
cin >> man2;
cout << "Enter the name of product2." << endl;
cin >> product2;
cout << "Enter price2." << endl;
cin >> price2;
cout << "Enter quantity2." << endl;
}
}
if (display == 1)
{
cout << "display1" << endl;
if (choice == 3)
{
cout << "Set either product1 or product 2 to default values?" << endl;
cout << "Input 1 for product1 or 2 for product 2." << endl;
cin >> display;
}
}
}
Sep 18, 2013 at 5:08am UTC
on line 66, before the endl you have written '<' instead of '<<'
on line 67, you've written "tValue2", on line 13 you've declared the identifier as "tvalue2"
Sep 19, 2013 at 9:32pm UTC
Thank you very much!
Topic archived. No new replies allowed.