assignment on c++

0 Sadick Sessah-Odai · March 24, 2015
Hello please i need help on these questions.
1.      Kyle is working on a loop that will execute several lines of code multiple times within a program.  Each time the code executes the program should prompt the user to enter in a test grade.  He is debating between the following two program statement setups
A.      for (int index = 0; grade < index; index++)      
  print(“Please enter another grade);     grade= keyboard.readDouble();  
B.      for (int index = 0; grade < index; index++)        {    
 print (“Please enter another grade);     grade= keyboard.readDouble();         }  
Which statement below best outlines the choice (A or B) Kyle should make concerning his code.
The code within section A or B would allow the person to enter the grade multiple times

The code within section A would be the best selection because the {} brackets indicate a decision must be made within a program.
The for loop is structured incorrectly in both A and B meaning Kyle should rewrite the code statement.
The code within section B is the best selection because the {} brackets allow both lines of code to be executed each time the loop occurs.
2 Jay is considering adding a repetition statement within his C++ programming final project.  Jay is unsure of the number of times each loop needs to execute.  Analyze the conditional statements below and select which statement best fits the need identified by Jay within his programming.
while loop

for loop
D. Switch Statement

3        Write a C++ expression for the following:
a.       Decrease A by the square root of the values assigned to B.
b.      Decrease the value of T by two third of the value assign to S less 8
c.       Assign the average of A,B and C less twice the value assigned to R to H
d.      a3 -3a2b + 3ab2-b3
e.       Increase the value assign to U by three times the value assign to V less double y


Post a Reply


Oldest  Newest  Rating
0 Dol Lod · March 24, 2015
1. I have a question on the first part: is print(?Please enter another grade); a typo or not with the question mark. 

That being said, I will say something more general regarding for loops. Without using braces, only the next immediate statement will be executed for the for loop. 

2. Honestly this question is poorly worded. My only piece of advice is to think about when the number of iterations matter and when they don't. 

3. Look up math libraries for C++. 
0 Bucky Roberts · March 24, 2015
Do your own homework.
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator