So we have been given step by step directions to build a program in preparation for our final. The broad description of the program can be seen here
http://www.cplusplus.com/forum/general/156346
I do not need help building the entire program, as this other user is requesting, however I am having trouble with certain steps within the program. Here is the what I have thus far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include <iostream>
using namespace std;
const int flexibility_factor = 0.1725;
int main()
{
int i;
float x, y, z;
char type;
int num_characters;
cout << "Enter the number of characters to create:\n";
while (true)
{
cin >> num_characters;
if (num_characters < 1)
cout << "Enter the number of characters to create:\n";
else
break;
}
|
Here are the next few instructions that I have gotten stuck on...
Instruction
(Box 9)
Write the start of a for loop that:
Iterates num_characters times
Do NOT write the body of the for loop
Use the integer variable i as your iterator. It has already been declared for you.
You are finished with this block when you type your opening brace '{'
Instruction
(Box 10)
Now you are inside of your for loop
Do NOT prompt the user
Input from the user the type of character and store this into your type variable
Input from the user the value x, y, and z in that order and store into your x, y, and z variables
Instruction
(Box 11)
Now you have good values in type, x, y, and z
Write a switch statement that checks the value of type
If type is A, add half the value of x to the value of y.
If type is B, add double the value of z to the value of x.
If type is C, add 33% of the value of y to the value of z.
If type is not A, B, or C, set the value of z to the average of x, y, and z