Question

Write pseudocode and the write the source code in C++, thanks!Program 0: Insulted yet? Most people get harassed by telemarketers, so for your warmup question, youre going to design (pseu

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

Code:

#include<iostream>
#include<stdlib.h>
#include<time.h>
#include<string>
using namespace std;
void ins(string name){
   int x;
   x=rand()%5+1;
   if(x==1){
       cout<<name<<",your mother was a hamster!"<<endl;
   }
   else if(x==2){
       cout<<name<<",you English pig dog!"<<endl;
   }
   else if(x==3){
       cout<<name<<",you don't frighten me!"<<endl;
   }
   else if(x==4){
       cout<<"Now go away,you silly English Knniggets!"<<endl;
   }
   else{
       cout<<name<<",you lazy!"<<endl;
   }
}
int main(){
   srand(time(0));
   string s,c;
   cout<<"Enter your name:";
   getline(cin,s);
       ins(s);
   while(1){
       cout<<"Shall I taunt you another time[yes/n]):";
       cin>>c;
       if(c=="no"){
           break;
       }
       ins(s);
   }
}

Output:

Enter your name:King Arthur King Arthur, you English pig dog! Shall I taunt you another time(yes/n]):yes King Arthur, you don

Pseudocode:

function:

return type functionname(string name):

       generate random number x

      if x==0:

          print insult1

     else if x==1:

         print insult2

   .

    .

   .

end

Add a comment
Know the answer?
Add Answer to:
Write pseudocode and the write the source code in C++, thanks! Program 0: Insulted yet? Most...
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
  • Please do in Java source Insulted yet? Most people get harassed by telemarketers, so for your...

    Please do in Java source Insulted yet? Most people get harassed by telemarketers, so for your warmup question, you’re going to design (pseudocode) and write (source code) a program that generates (clean) insults at random. The program must have a function that takes in the name of a person and prints out an insult directed to them. Further, the program should ask if the person has had enough insults and continue until they type “yes”. Your code must have at...

  • 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...

  • java pseudocode and source code help? Write a program that uses an array of high temperatures...

    java pseudocode and source code help? Write a program that uses an array of high temperatures for your hometown from last week (Sunday - Saturday). Write methods to calculate and return the lowest high temperature (minimum) and a method to calculate and return the highest high temperature (maximum) in the array. You must write YOUR ORIGINAL methods for minimum and maximum. You MAY NOT use Math class methods or other library methods. Write an additional method that accepts the array...

  • PSEUDOCODE AND JAVA SOURCE CODE PLEASE: Program 1 (60 pts): Find the Rabbit! For this assignment,...

    PSEUDOCODE AND JAVA SOURCE CODE PLEASE: Program 1 (60 pts): Find the Rabbit! For this assignment, you will write a program that asks the user to find a rabbit in one of 10 holes (0-9). The holes and guesses are visualized on the screen (as shown below), but as the user guesses, you should not show where the rabbit is hidden. The rabbit is assigned a random hole each time the program is run. You must write and use at...

  • This is a C program. please help me to write a pseudocode of the program ....

    This is a C program. please help me to write a pseudocode of the program . also, I want the program In a do...while loop and the screen output should look like in the picture. please help me. 3.1. Write a program that asks the user to continue to enter two numbers (at a time). For each pair of numbers entered, the program calculates the product of those two numbers, and then accumulate that product. For each pair of numbers...

  • 05-02-2017 CMSC 250 Problem (3): YOU write some (pseudo-)code! (90 pts) write a program in pseudocode...

    05-02-2017 CMSC 250 Problem (3): YOU write some (pseudo-)code! (90 pts) write a program in pseudocode (Similar to the code on the Big-o slides) for the following problems 1. (15 points) Given n, z1,z2,zs, 4 determine if there is a c c4 such that The program MUST run in O(m) time. 2. (15 points Given n z .z2.zs, do Two things: (1) determine if there is a ci, c2.cs,c4 such that AND (2) if there IS such a c c2,...

  • This program should be written as a C code, You need to think how to break...

    This program should be written as a C code, You need to think how to break it down to steps that can do the program. I DON'T WANT YOU TO WRITE THE CODE, I only need you to tell me something like ( first you need a code the do.....) I'm really having a difficult time understanding how it can be written in C or C++

  • How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the use...

    How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the user to input the following. ○ How many apples are on hand ○ How many apples should be in stock ○ How many oranges are on hand ○ How many oranges should be in stock  Perform an operation to determine how many of...

  • Please don't use a void fuction and this is a c++ question. Thanks Write a program...

    Please don't use a void fuction and this is a c++ question. Thanks Write a program that reads two input files whose lines are ordered by a key data field. Your program should merge these two files, writing an output file that contains all lines from both files ordered by the same key field. As an example, if two input files contain student names and grades for a particular class ordered by name, merge the information as shown below Using...

  • Write a C program as follows: Single source code file Calls a function with an arbitrary...

    Write a C program as follows: Single source code file Calls a function with an arbitrary name (i.e. you name it) that accepts two arrays of the same size The function should add each element in the arrays together and place the values in a third array Each array element, each array address, and the sum are printed to the screen in tabulated format with headersI also would like to request that LOTS of comments be included, as I need...

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