what are these errors?

hello can anyone tell me what i am doing wrong here? when i try to build this i get two errors; : error C2059: syntax error : ';' and fatal error C1075: end of file found before the left brace '{'


This is the problem I am attempting to solve:
Design and write a C++ program that inputs a series of 24 hourly temperatures from a file, and outputs a bar chart (using stars) of the temperatures for the day. The temperature should be printed to the left of the corresponding bar, and there should be a heading that gives the scale of the chart. the range of temperatures should be from -30 to 120.

here is what I have so far.

#include <fstream>
#include <iostream> //This is for input and output of the file
#include <string>

using namespace std;

const string stars = "*";
const string line = "|";
int main()

{
int count;
float temperature;
string fileName;
float negative;
float positive;


cout << ("Enter file name: ");
getline(cin, fileName);

if(temperature == negative)
{
cout << "Can not open the input file" << endl;
return 1;
}

if(temperature == positive)
{
temperature= 0;
while(temperature <= 120)
{
count = 0;
while(count <= temperature)
{
cout << '*';
cout+;
}
temperature++;

cout << endl;
return 0;
{
Last edited on
At the end, did you mean } instead of { ? Also, I think you're a few } short, but that's just a hunch.

Also this:
cout+;
Did you mean:
count++;
?

-Albatross
Thank you so much, I mis-typed count and put cout+. So that solve that error.
Still dont know what is up with the braces error. I did change the last '{' to '}'

This is all greek to me...I am just learning all this and it is confusing to me.

Again...Thank You so much!
Ancient greek's a fun, well known, perfectly understandable, and not at all dead language. What are you talking about? ;)

By my count you're two closing braces short.

-Albatross
Oh wow, well any greek is 'greek' to me. lol

Thanks for the info!
can you please tell me what this error message means

Run-Time Check Failure #3 - The variable 'temperature' is being used without being initialized.
Run-Time Check Failure #3 - The variable 'negative' is being used without being initialized.

And how do i initalize this?
It means you need to give it a value. In your code above, you never set 'temperature' or 'negative' to anything. They could be any value, it's just left-over memory until you set them to something else.
Thank you LB.

I know that I wasn't directly told do not ask for help. I did receive one email that suggested I should already know all this. As I said earlier this is my 2nd program to write and I suppose I do overlook some things.

anyway thank you again. have a great day!
Topic archived. No new replies allowed.