|
|
Subject:
C++ programming
Category: Computers Asked by: gevancio-ga List Price: $10.00 |
Posted:
30 May 2004 19:03 PDT
Expires: 29 Jun 2004 19:03 PDT Question ID: 354074 |
Write a program that allows you to enter 10 item stock numbers, prices and quantities in stock into three parallel arrays. Display all the data in report form, that is, aligned correctly in columns. In C++ |
|
Subject:
Re: C++ programming
Answered By: tox-ga on 30 May 2004 22:48 PDT Rated: |
Hi gevancio-ga, Here is the program you requested: #include <iostream> using namespace std; int main() { int a[10], b[10], c[10]; for (int i=0; i<10; i++) { cout << "Enter stock number for item " << i+1 << ": "; cin >> a[i]; cout << "Enter price for item " << i+1 << ": "; cin >> b[i]; cout << "Enter quantity for item " << i+1 << ": "; cin >> c[i]; } cout << " Stock Number Price Quantity" << endl; for (int j=0; j<10; j++) { cout.width(15); cout << a[j]; cout.width(15); cout << b[j]; cout.width(15); cout << c[j] << endl; } return 0; } If you would like an explanation of how it works or would like me to help you change anything to better suit your needs, please feel free to ask. Best regards, tox-ga | |
| |
|
gevancio-ga
rated this answer:
It worked great once I entered it in Win 32 console application. Sorry about the request for clarification. Thanks, Gary |
|
Subject:
Re: C++ programming
From: darrenw-ga on 31 May 2004 17:51 PDT |
Use better variable names than a,b,c,j,i. Shocking! |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |