Sunday, August 2, 2009

Psuedocode..is this right? or is there confusion wiht c++?

1.a Write pseudocode that is the equivalent to "you will not win the marathon if you don't train".








1a)


int training %26lt;- 0;





print -%26gt; "On a scale from 1 - 10 (10 being highest) how hard are you training?"


training -%26gt;readInput


if (training %26lt;= 7)


print -%26gt; "you will not win the marathon if you don't train".


else if (training%26gt; 7)


print -%26gt; "If you train hard you will win!"





// if training is greater then 10 print


else


print -%26gt; "dont kill yourself!"

Psuedocode..is this right? or is there confusion wiht c++?
It is pseudocode but you should include the error cases if the user inputs a negative value or input a letter.





such as





if( trainning %26lt; 0 )


print -%26gt; "Please use valid numbers between 1 -10"

queen of the night

No comments:

Post a Comment