Concept explainers
A) (Assume the user enters George Washington.)
string userInput;
cout << "What is your name?";
cin >> userInput;
cout <<"Hello"<< userInput << endl;
B) (Assume the user enters George Washington.)
string userInput;
cout << "What is your name?";
getline (cin, userInput);
cout <<"Hello"<< userInput << endl;
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Starting Out With C++: Early Objects (10th Edition)
Additional Engineering Textbook Solutions
Introduction To Programming Using Visual Basic (11th Edition)
Mechanics of Materials (10th Edition)
SURVEY OF OPERATING SYSTEMS
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
- C# (Sharp): Make a console application that will ask user for a name and age. If the age is less than or equal to 64, display the message: Hello <name> since you are <age> years old, you are not of retirement age. If the age is greater than 64, display the message: Hello <name> since you are <age> years old, you are ready for retirement. *** Make sure to substitute <name> and <age> with inputs ***arrow_forwardUsing c++ write a program : Write a program in C++ to handle the following scenario: Three friends Asif, Shahid and Bashir start the business. Input following from user. Enter amount invested by Asif (user will enter any value) Bashir’s contribution is equal to 250% of Asif’s contribution and Shahid’s contribution is equal to 75% of Bashir’s contribution. Display amount contributed by Bashir and Shahid. After 6 months business earned profit of 50% of total investment. Display the total profit and the amount each sharer will get (i.e. distribute profit as per percentage of their investment).arrow_forwardc++arrow_forward
- Code using java programming language.arrow_forwardProgramming Problem 2 – Vending Machine Write a program that simulates the functionality of a vending machine having the following characteristics: · The vending machine offers 5 products · The vending machine accepts coins, 1 dollar bills, and 5 dollar bills • The change is always given in coins, with maximum possible number of coins in each value: 25, 10, 5 or 1 cent. • The selections available for user are numbers from 1 to 5. • The user enters the money – simulate the action through a loop that ends when the user enters 0. Each coin, or paper bill will be read individually. • The user makes the selection, and the machine allows a maximum 4 other selections if the amount entered doesn't cover the price of the item. • Once an item is delivered, the machine gives the change in coins. • There is no increment for the money during one selection. • The user can stop the selection at any time by entering 0 for the product selection. • If the user chooses to cancel the selection, the…arrow_forwardPlease help me in c++ languagearrow_forward
- int calculatepower (int x, int y){ if (y > 0) return x* else return 1; int main (){ int num, pwr; cout > num; cout > pwr; cout <« "Number "<arrow_forwardLanguage C++arrow_forwardHide and Seek Write a program to play “Hide and Seek” with the name of ourprogramming language. When the button is clicked on, the name should disappear andthe caption on the button should change to “Show Name of Language”. The next time thebutton is clicked, the name should reappear and the caption should revert to “Hide Nameof Language”, and so on.arrow_forwardlanguage c++arrow_forwardJava Lab 5 Problem Statement Write a program that quizzes the user on the names of the capital cities for all the states in the United States. Each state is presented to the user, and they must enter the name of the capital. The program then either tells the user they're correct or tells them the correct answer. The user's answer should not be case-sensitive. At the end, the program tells the user the total number they got correct. Here's an example: What is the capital of Alabama? MontogomeryThe correct answer is Montgomery.What is the capital of Alaska? juneauThat is the correct answer!...You got 32 out of 50 correct! The state capitals will be stored in a 2D String array of size 2 x 50, with the first column the name of the state and the second the name of the capital city, for all 50 states. To create the state capitals array, follow these instructions: Copy the String from the attached file into your program (found below these instructions). The String is a pipe delimited…arrow_forwardA) (Assume the user enters George Washington .)string userlnput;cout << "What is your name?";cin >> userlnput;cout <<"Hello"<< userlnput << endl;B) (Assume the user enters George Washington.)string userlnput;cout << "What is your name?";getline (cin , userlnput);cout <<"Hello"<< userlnput << endl;arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning