Assistance in Interpreting Instructions

Hello all, I am new here and new to C++ and programming in general. I am working on a lab for my class and my teacher wrote out some pseudo-code to help guide us in finishing the lab. The problem is I am having trouble interpreting what is being suggested by "Load into result?", and especially what in the world "load the result in result" means. I tried figuring it out through my notes, my textbook, and the internet but nothing is clicking. The lab instructions, which I am fairly sure I understand, are included for reference under the pseudo-code. I apologize in advance for any moments of stark ignorance that I will likely have.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  PSEUDO CODE FOR LAB #5

START A LOOP #1
Prompt the user to enter the first number (load into result?)
START A LOOP #2
START LOOP #3
Prompt the user to enter the operator  (*,/,+,-,C,X) (char type values)
	If C – clear the result and start at LOOP #1
	If X – end the program (break) make sure you break out of all the loops
If no valid operators were entered LOOP TO THE  TOP OF LOOP #3
Prompt the user to enter the second number to be operated on
Perform the operation (check for divide by 0) and load the result in result
END OF LOOP #2 LOOP TO THE TOP OF  LOOP #2
If X was entered  break out of LOOP #1
END OF LOOP #1 LOOP TO THE TOP OF LOOP #1


Write a program, which will act as a simple four-function calculator. That is it will:
read a number
read an operator
read another number
then do the operation

The calculator works with integers and uses four functions: +, -, *, and /. You will need to check to make sure the user is entering a valid operator. If the operator is invalid, you should ask for a valid operator.

After the first operation is completed, the program will read another operator and use the result of the previous operation as the first value for the next operation.

If the user enters a C in place of an operator, the result is cleared and then the user starts as if the calculator had just powered up.

If the user enters an X inplace of an operator, the calculator is turned off.

The various input values (i.e. numbers, operators, commands) will be followed by the ENTER key.

Your program should prompt the user on what the user is to do.

All numbers entered and displayed will be integer values.

Regardless of math operation attempted, the program must not die. If the math operation would cause a fatal error in your program you should check for it and issue an error message rather than attempting the operation
Morning,
This is just a guess but maybe he/she means "assign to a variable".
i.e.

1
2
3
4
5
6
// in your first loop

   int  result = 0;
   cout << "Please enter a the first value: ";
   cin >> result;


Your line number 8 would seem to back up this guess. A bit :)
Last edited on
closed account (48T7M4Gy)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
START A LOOP #1
    Prompt the user to enter the first number (load into result?)

    START A LOOP #2

        START LOOP #3
            Prompt the user to enter the operator  (*,/,+,-,C,X) (char type values)
            If C
                clear the result and start at LOOP #1
            If X
                end the program (break) make sure you break out of all the loops
            If no valid operators were entered LOOP TO THE  TOP OF LOOP #3

        Prompt the user to enter the second number to be operated on
        Perform the operation (check for divide by 0) and load the result in result
    END OF LOOP #2
    LOOP TO THE TOP OF  LOOP #2

    If X was entered
        break out of LOOP #1

END OF LOOP #1
LOOP TO THE TOP OF LOOP #1 
Topic archived. No new replies allowed.