| marvin77 (27) | |
|
Create a program to ask for the number of sales per store and display barchart report in the form of the sale. For example: Sales Report ----------------------------------------------- (each x represents Rp. 1.000.000, -) Toko Grogol: xxxxx Toko Tomang: xxxxxxxxx Toko Puri: xxxxxxx Toko Slipi: xxxx Toko Kopro: xxxxxxxx That is the question, and this is my program, but it doesn't work at all T_T, can someone help me? #include <iostream> using namespace std; void main () { int TG,TT,TP,TS,TK,LPG,LPT,LPP,LPS,LPK; cout << " Banyaknya penjualan setiap toko : " << endl; for (TG=1;TG<=5;TG++) {cin >> LPG; cout << " " << LPG << " " << TG << endl;} for (TT=1;TT<=9;TT++) {cin >> LPT; cout << " " << LPT << " " << TT << endl;} for (TP=1;TP<=7;TP++) {cin >> LPP; cout << " " << LPP << " " << TP << endl;} for (TS=1;TS<=4;TS++) {cin >> LPS; cout << " " << LPS << " " << TS << endl;} for (TK=1;TK<=8;TK++) {cin >> LPK; cout << " " << LPK << " " << TK << endl;} system ( " Pause " ); } | |
|
|
|
| Dragonster82 (12) | |
|
First of all, explain what Rp is. Next of all, you might want to organize your code in a more tidier way. E.g: for ( TS=1;TS<=4;TS++) { cin >> LPS; } Last of all, explain what all your variables do, and do not type in foreign languages. Most of the people here speak English, not other languages. P.S Edit: Do not use void main, use int main() instead. | |
|
Last edited on
|
|
| marvin77 (27) | |
|
ok Rp is currency, Rupiah The variable is for decide the amount of each "toko" example TG is for LPG i tried so hard that you all can understood my english, sorry for my bad english thank you i don't know how to build a barchart using c++ | |
|
|
|
| Dragonster82 (12) | |||
Tell me if it works. | |||
|
|
|||
| marvin77 (27) | |
|
WOW it works, but why after i input all the number, the program actually end, and then why you use int and void main, can you explain it to me thanks before ^^ | |
|
|
|
| Dragonster82 (12) | |
|
What do you mean program actually end? Every program is supposed to end after doing what they're supposed to. And, int main is standard for all compilers of C++. void setX(int x) is the function of printing out the bar graph because it would be a mess if I did it manually. | |
|
|
|
| marvin77 (27) | |
| i mean before the end, i usually have getch(); or System("pause"); to stop the program, so my teacher can see it, but in your program when i add it, the program didn't pause, then when it didn't pause, how can my teacher see my assignment, thank you before ^^ | |
|
|
|
| Dragonster82 (12) | |
|
Now that you aren't using void main(), you should type either return 0; or system("PAUSE"); Because I am writing the program in codeblocks and if I do not add return 0, it will automatically add for me. P.S : I am lazy | |
|
|
|
| marvin77 (27) | |
|
sorry for my long reply ahhh, i get it, thank you ^^ | |
|
|
|