Hi all...

Was wondering if someone could lend a hand - or an eye. I've been trying for hours and was hoping that someone could give me an outside look. I won't beat around the bush, yes this is from a homework assignment, but the assignment is much more than just the loop, and might I add again that I have been working on it for the past couple of days. Here is the loop,


		if(temp1>120 || temp1<-30)
			cout<<"Error: Temperature must be between -30 & 120 degrees." <<endl <<endl;
			return 1;
		else if (temp1>=120)
			cout<<setw(72) <<"*" <<endl;
		else if (temp1>=110)
			cout<<setw(68) <<"*" <<endl;
		else if (temp1>=100)
			cout<<setw(64) <<"*" <<endl;
		else if (temp1>=90)
			cout<<setw(60) <<"*" <<endl;
		else if (temp1>=80)
			cout<<setw(56) <<"*" <<endl;
		else if (temp1>=70)
			cout<<setw(52) <<"*" <<endl;
		else if (temp1>=60)
			cout<<setw(48) <<"*" <<endl;
		else if (temp1>=50)
			cout<<setw(44) <<"*" <<endl;
		else if (temp1>=40) 
			cout<<setw(40) <<"*" <<endl;
		else if (temp1>=30)
			cout<<setw(36) <<"*" <<endl;
		else if (temp1>=20)
			cout<<setw(32) <<"*" <<endl;
		else if (temp1>=10)
			cout<<setw(28) <<"*" <<endl;
		else if (temp1>=0)
			cout<<setw(24) <<"*" <<endl;
		else if (temp1>=-10)
			cout<<setw(20) <<"*" <<endl;
		else if (temp1>=-20)
			cout<<setw(16) <<"*" <<endl;
		else if (temp1>=-30)
			cout<<setw(12) <<"*" <<endl;


I'm trying to get the loop to stop at the end of the file (inData), but the problem that I run into is that the last temperature(value) in the file gets printed twice.

Thanks Much,

I realized I needed a priming read and put the next read-in to inData at the end of the loop ---- I suddenly feel like a jackass... oh well

This article has been dead for over six months. Start a new discussion instead.