Oct 23, 2012 at 1:26pm UTC
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 " );
}
Oct 23, 2012 at 1:55pm UTC
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 Oct 23, 2012 at 2:00pm UTC
Oct 23, 2012 at 2:08pm UTC
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++
Oct 23, 2012 at 2:36pm UTC
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 ^^
Oct 24, 2012 at 5:07am UTC
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.
Oct 24, 2012 at 6:01am UTC
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 ^^
Oct 24, 2012 at 8:23am UTC
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
Oct 30, 2012 at 3:09am UTC
sorry for my long reply
ahhh, i get it, thank you ^^