Hello guys,
we have the following pseudocode and need to create the C++ code accordingly.
Code:Function main Pass In: nothing Do Display a message asking user thier age Get the users age from the keyboard Display a message asking user for thier friend's age Get the users friends age from the keyboard If age_user equal to age_friend Display "You and your friend are the same age." Display "You should celebrate together." Else Display "You and your friend are not the same age." Display "You should party together anyway." Endif Display a message asking user if they want to do it again Get the response for loop_control from the keyboard While loop_control equals'Y' or loop_control equals 'y' Pass Out: zero to the OS Endfunction
Here's what I got so far:
It says something is not ok with the caracter_loophole. And I don't really know what is meant by Pass Out: zero to the OS !Code:int main(void) { do { cout << “\nWhat is your age? “; cin >> age_user; cout << “\nWhat is your friend’s age? “; cin >> age_friend; if (age_use == age_friend) cout << “\nYou and your friend are the same age. “; cout << “\nYou should celebrate together. “; else cout << “\nYou and your friend are not the same age. “; cout << “\nYou should party together anyway. “; end if; cout << “\nDo you want to do it again? y or n “; cin >> loop_control; } while (loop_control == ‘y’); } pause(); return 0; }
I hope somebody can help me.
Thank you!




Reply With Quote