Re: What's wrong with my code?

  • From: Jes <theeternalkid@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Tue, 6 Jul 2010 00:31:19 -0400

Thanks Joseph and others for your quick feedback. I'll compare Ken's version to 
some other test programs I've written that have compiled to see where my 
confusion lies.
Jes

On Jul 6, 2010, at 12:05 AM, Joseph Lee wrote:

> Hi Jess,
> You almost got it. Few suggestions:
> You might want to look at your entry code. Notice that there are two 
> less-than signs (left arrows). The less-than signs are used for output. If 
> you want to get a user to type something, you would use what…
> Second, when you declare variables, you might want to try doing it in the 
> main() function. Doing it outside means that the compiler will complain as to 
> where these three things belong. Also, integer values are meant for whole 
> numbers. To use decimals, you would use what…
> The reason why I’m posing this as a question is for you to figure out an 
> answer – maybe coming up with your answers to help us figure out how to help 
> you out in the end. Don’t worry, I (or others) will post something about this 
> program later (perhaps a hint of a direction).
> Hope this helps.
> Cheers,
> Joseph
>  
>  
> From: programmingblind-bounce@xxxxxxxxxxxxx 
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jes
> Sent: Monday, July 05, 2010 8:55 PM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: What's wrong with my code?
>  
> Hi all,
> This is a programming assignment I'm trying to do out of the class text book. 
> Any assistance would be appreciated, as well as any feedback on how I am 
> doing writing the code. I have this habit of not writing the code all the way 
> through, and compiling the program bit by bit to make sure I don't get any 
> errors in the process of coding. I just want to make sure that the code I 
> have already written is working as it should before I continue writing. I'm 
> sure this is not a good habit to get into.
> Thanks for any help.
> Jes
>  
> //Ch5 Exercise 4, page 287 //Calculates and displays the average of three 
> test scores
> //created/revised by Jes Smith on July 5 2010
>  
> #include <iostream>
> using <<std::cout;>>
> using <<std::cin;>>
> using <<std::endl;>>
>  
> //declare variables
> int score_1 (0);
> int score_2 (0);
> int score_3 (0);
>  
> //begin program
> int main()
> {
>                 cout< "Please enter your first test score. You may enter 
> decimal values: " >;
> cin << score_1 >>;
> cin <<score_2 >> ;
> cin <<score_3 >> ;
>  
> return 0
> }
>  
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.439 / Virus Database: 271.1.1/2981 - Release Date: 07/05/10 
> 18:36:00
> 

Other related posts: