Question

In: Computer Science

Write a C++ program to display toy name

  1. Write a C++ program to display toy name

Solutions

Expert Solution

Code:

--------

#include <iostream>

using namespace std;

int main()

{

string toyName;

cout<<"Enter the toy name to be displayed: ";

//cin>>toyName;

getline(cin,toyName);

//The above line will scan the keyboard inputs

//and store it to "toyName" variable

//Difference between "cin>>toyName" and "getline(cin,toyName)"

//is that firstone will store only one word whereas

//secondone will take whole line

cout<<"Toy Name entered by you is: "<<toyName;

return 0;

}

Output:

--------


Related Solutions

Using c++, write a program that will display your name as a void function then will...
Using c++, write a program that will display your name as a void function then will perform the following by user-defined functions: a. to compute for the sum of two numbers (n1, n2) using function.
IN C++ LANGUAGE PLEASE::: Design and implement a program (name it Rectangle) to calculate and display...
IN C++ LANGUAGE PLEASE::: Design and implement a program (name it Rectangle) to calculate and display the area and perimeter of a rectangle with width = 4 and height = 8.
Write a program that accepts user’s name, password and address and display them back using the...
Write a program that accepts user’s name, password and address and display them back using the format “Hi, I am user’s name. I live at user’s address.”. Restrictions: ▪ Use only three variables. ▪ Make sure you support spaces.
Write a C program that creates a toy scheduler for the child processes in part A....
Write a C program that creates a toy scheduler for the child processes in part A. This program takes as input the number of processes, and all of the PIDs that are being echoed. HINT: Look up redirecting echo output. The program will schedule the ”processes” (note that these are not true processes, this is a toy system. You are effectively only scheduling echo statements). The result of the scheduler will be to echo the PID and current system time...
Write a C program that meets the following requirements. Uses a while loop to display the...
Write a C program that meets the following requirements. Uses a while loop to display the first 10 natural numbers (on one row, with a tab separating each number) Uses a while loop to find the sum of the second set of 10 natural numbers. Reads a user entry and displays all the natural numbers up to the user entry (on a column list with a new line separating each number). Finds and displays the sum of all natural numbers...
Write a C++ program that will display the top internet stories from the stories.txt file The...
Write a C++ program that will display the top internet stories from the stories.txt file The program must display the stories that have a score which the statistical "mode". The "mode" of a set of values is the value that occurs most often (with the greatest frequency) The data about the stories is in a file that contains the following: storyTitle    (a sequence of numbers and/or letters, may contain spaces in it) storyURL    (a regular URL, like http://www.twitter.com/story1,without spaces) score        (an integer number,...
ACTIVITY #1: Defining Strings √ Write an assembly program that display your name, your id, and...
ACTIVITY #1: Defining Strings √ Write an assembly program that display your name, your id, and your college name on the screen. √ Remember: the format of the assembly program should be like this. TITLE your title (FileName.asm) .MODEL FLAT .386 .STACK 64 .DATA str1 DB "My name: Essam Alnatsheh",13,10,'$' .CODE main PROC mov ax,@data mov ds,ax mov ah,09h mov dx, offset str1 int 21h ​mov ah,4Ch​​ ; terminate process ​mov al,0​​ ; return code ​int 21h main ENDP END...
Description: Write and test a MASM program to perform the following tasks: 1. Display your name...
Description: Write and test a MASM program to perform the following tasks: 1. Display your name and program title on the output screen. 2. Display instructions for the user. 3. Prompt the user to enter two numbers. 4. Calculate the sum, difference, product, (integer) quotient and remainder of the numbers. 5. Display a terminating message. Requirements: 1. The main procedure must be divided into sections:  introduction  get the data  calculate the required values  display the results...
Part 1 Write a program that displays a frame containing two labels that display your name,...
Part 1 Write a program that displays a frame containing two labels that display your name, one for your first name and one for your last. Experiment with the size of the window to see the labels change their orientation to each other. USE FIRST NAME: Aya LAST NAME: KAYED. SEND THE CODE IN THE EXACT FORMAT FOR JAVA ECLIPSE. I WILL COPY AND PASTE THE CODE SO I CAN RUN IT. Part 2 Propose and solve your own digital...
C++ Write a program that prompts for a file name and then reads the file to...
C++ Write a program that prompts for a file name and then reads the file to check for balanced curly braces, {; parentheses, (); and square brackets, []. Use a stack to store the most recent unmatched left symbol. The program should ignore any character that is not a parenthesis, curly brace, or square bracket. Note that proper nesting is required. For instance, [a(b]c) is invalid. Display the line number the error occurred on. These are a few of the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT