Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-04-2014, 10:00 PM   #1
LQ Newbie
Registered: Feb 2014
Posts: 1

Rep: Reputation: Disabled
Exclamation Code to make Bar Graph keeps giving errors

ok so i have this code

#include <iostream>

using namespace std;

int main(){
int store1 = 0;
int store2 = 0;
int store3 = 0;

cout <<"Enter today's sales rounded to the nearest $100 for store 1: ";
cin >> store1;

cout <<"Enter today's sales rounded to the nearest $100 for store 2: ";
cin >> store2;

cout <<"Enter today's sales rounded to the nearest $100 for store 3: ";
cin >> store3;

cout << "DAILY SALES (each * = $100)";
cout << "Store 1:"
for (int i=0; i<= store1/100; i++){
cout << "*";
cout << "Store 2:"
for (int c=0; c<= store2/100; c++){
cout << "*";
cout << "Store 3:"
for (int f=0; f<= store3/100; f++){
cout << "*";

return 0;

and I keep coming up with tons of errors whenever I try to run it, but I dont see anything wrong? The point is to make a bar graph for each of the stores with each * representing $100 in sales
Old 02-04-2014, 11:06 PM   #2
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288

in general you should post the compilation errors, and you should also put the code inside [code] tags. Anyway I can see three lines missing trailing semicolons. Also, you probably what to write a newline after each loop. Eg
cout << endl;



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create a bash script that creates a bar graph in the terminal window Satsugyo Linux - Newbie 10 11-26-2012 02:37 AM
Glibc giving Errors on Make Check in LFS 7.1 xerofoify Linux From Scratch 3 08-21-2012 12:02 PM
unix shell script to generate a bar graph pghosh06 Linux - Newbie 4 02-10-2011 04:01 AM
'make' giving errors... bharathp Linux - Hardware 9 11-22-2009 12:12 AM
nagios + pnp4nagios how make graph from total processes mkiler Linux - Server 0 02-27-2009 08:44 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:11 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration