| | |
charting using for loops??
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 32
Reputation:
Solved Threads: 4
Didn't I do that?
I'm just a student as well, if you know of a different way to do that dynamically please post it and explain the differences.
afg, do you need help understanding dynamic memory allocation? I'm not a master on the subject but I know the basics
I can make a chart to explain it to you just like my teacher did =3
I'm just a student as well, if you know of a different way to do that dynamically please post it and explain the differences.
afg, do you need help understanding dynamic memory allocation? I'm not a master on the subject but I know the basics
I can make a chart to explain it to you just like my teacher did =3 •
•
Join Date: Oct 2008
Posts: 32
Reputation:
Solved Threads: 4
Ok, so this is the type of solution afg was looking for, with no arrays or dynamic allocation.
You can either use
alone to pause the program, or use both
together to achieve the same result.
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; int main() { int sale1, sale2, sale3, sale4, sale5; cout << "Enter today's sale for store 1: "; cin >> sale1; sale1 /= 100; cout << "Enter today's sale for store 2: "; cin >> sale2; sale2 /= 100; cout << "Enter today's sale for store 3: "; cin >> sale3; sale3 /= 100; cout << "Enter today's sale for store 4: "; cin >> sale4; sale4 /= 100; cout << "Enter today's sale for store 5: "; cin >> sale5; sale5 /= 100; cout << endl; cout << "SALES BAR CHART" << endl; cout << "---------------" << endl; cout << "Store 1: "; int row; for ( row = 0; row < sale1; row++) cout << '*'; cout << "\nStore 2: "; for ( row = 0; row < sale2; row++) cout << '*'; cout << "\nStore 3: "; for (int row = 0; row < sale3; row++) cout << '*'; cout << "\nStore 4: "; for (int row = 0; row < sale4; row++) cout << '*'; cout << "\nStore 5: "; for (int row = 0; row < sale5; row++) cout << '*'; //cin.get(); //cin.ignore(); system("pause>nul"); return 0; }
system("pause>nul"); alone to pause the program, or use both
cin.get(); cin.ignore(); together to achieve the same result.
![]() |
Other Threads in the C++ Forum
- Previous Thread: Jiberish Visual C++ Errors Un-Understandable
- Next Thread: Template problem - error status -1073741819
| Thread Tools | Search this Thread |
api array beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game getline google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text text-file tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






