Question

C++ ONLY PLEASE! Assignment4A: Warm-up. Before everyone had a computer of their own, people had to...

C++ ONLY PLEASE!

Assignment4A: Warm-up. Before everyone had a computer of their own, people had to use a terminal, which was basically a monitor and a keyboard that connected to a shared mainframe computer. People would log into their accounts and start working using the command line (all typing, no mouse, no windows). When they got up to take a break, they often forgot to lock their terminal. That’s when people taught them a lesson by writing a simple program that asks for a cookie. And before you laugh away the command line, you need to realize that command-line compiling is a common interview question at Apple…

Write a program that continuously asks the user for a cookie and repeats until they type the word cookie. Start with pseudocode and include it in your source code. Call the file Assignment4A(.java, .cs, .cpp) and the class name Assignment4A.

Sample Output #1:

Gimme a cookie:

What?

Gimme a cookie:

Who is this?

Gimme a cookie:

asdf

Gimme a cookie:

No

Gimme a cookie:

cookie

Log out next time!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Screenshot

What? asdf #include <iostream> #include<string> Microsoft Visual Studio Debug Console Gimme a cookie : using namespace std; G

Program

#include <iostream>
#include<string>

using namespace std;

int main()
{
   //Variable for input
   string cookie = "";
   //Loop until cookie get
   do {
       //Prompt for input
       cout << "Gimme a cookie :\n";
       getline(cin,cookie);
   } while (cookie != "cookie"); //Check
   cout << "Log out next time!\n";//End
   return 0;
}

Output

Gimme a cookie :
What?
Gimme a cookie :
Who is this?
Gimme a cookie :
asdf
Gimme a cookie :
No
Gimme a cookie :
cookie
Log out next time!

Add a comment
Know the answer?
Add Answer to:
C++ ONLY PLEASE! Assignment4A: Warm-up. Before everyone had a computer of their own, people had to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Note: Write the pseudocode separately and the source code separately in java using the loops method...

    Note: Write the pseudocode separately and the source code separately in java using the loops method according to the question. Please make sure there is no errors. Program 0 (Warm up): Gimme a cookie! In the early days of computing, you likely couldn't afford your own computer. Instead, you had to sit at a terminal - which was literally just a monochrome monitor and keyboard that was connected to a big mainframe machine (hidden somewhere in the building). When you...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT