LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 02-04-2014, 09:00 PM   #1
bananagram
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, 10:06 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

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
Code:
cout << endl;
HTH,

Evo2.
 
  


Reply



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 01:37 AM
Glibc giving Errors on Make Check in LFS 7.1 xerofoify Linux From Scratch 3 08-21-2012 11:02 AM
unix shell script to generate a bar graph pghosh06 Linux - Newbie 4 02-10-2011 03:01 AM
'make' giving errors... bharathp Linux - Hardware 9 11-21-2009 11:12 PM
nagios + pnp4nagios how make graph from total processes mkiler Linux - Server 0 02-27-2009 07:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:25 AM.

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