Starting Out With C++: Early Objects (10th Edition)
10th Edition
ISBN: 9780135235003
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 3, Problem 27RQE
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;
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
C++ Language
Complete the function to replace any period by an exclamation point. Ex: "Hello. I'm Miley. Nice to meet you." becomes:"Hello! I'm Miley! Nice to meet you!"
#include <iostream>#include <cstring>using namespace std;
void MakeSentenceExcited(char* sentenceText) {
/* Your solution goes here */
}
int main() { const int TEST_STR_SIZE = 50; char testStr[TEST_STR_SIZE];
cin.getline(testStr, TEST_STR_SIZE); MakeSentenceExcited(testStr); cout << testStr << endl;
return 0;}
Void Do1 (int: &, a. int &b)
{
a = 5;
a = a + b;
b = a + 2;
}
Int main()
{
Int x = 10;
Do1 (x,x);
Cout << x << endl;
}
The output of this program is
c code
Screenshot and output is must
Chapter 3 Solutions
Starting Out With C++: Early Objects (10th Edition)
Ch. 3.1 - Prob. 3.1CPCh. 3.1 - What is the symbol called?Ch. 3.1 - Where does cin read its input from?Ch. 3.1 - Prob. 3.4CPCh. 3.1 - Assume value is an integer variable. If the user...Ch. 3.1 - A program has the following variable definitions....Ch. 3.1 - The following program will run, but the user will...Ch. 3.1 - Complete the following main function so that it...Ch. 3.2 - In each of the following cases, tell which...Ch. 3.2 - Complete the following table by writing the value...
Ch. 3.2 - Prob. 3.11CPCh. 3.2 - Study the following program code and then complete...Ch. 3.2 - Complete the following program skeleton so that it...Ch. 3.3 - Assume the following variable definitions: int a =...Ch. 3.3 - What will the following program code display if a...Ch. 3.3 - What will the following program code display? int...Ch. 3.5 - Prob. 3.17CPCh. 3.5 - Complete the following program code segment so...Ch. 3.6 - Write a multiple assignment statement that assigns...Ch. 3.6 - Write statements using combined assignment...Ch. 3.6 - What will the following program segment display?...Ch. 3.7 - Write cout statements with stream manipulators...Ch. 3.7 - The following program segment converts an angle in...Ch. 3.8 - Will the following string literal fit in the space...Ch. 3.8 - If a program contains the definition string name;...Ch. 3.8 - Prob. 3.26CPCh. 3.10 - Use a mathematical library function with a cout...Ch. 3.10 - Assume the variables angle1 and angle2 hold angles...Ch. 3.10 - To find the cube root (the third root) of a...Ch. 3.10 - Write a statement that produces a random number...Ch. 3 - Prob. 1RQECh. 3 - Prob. 2RQECh. 3 - Prob. 3RQECh. 3 - Assume the following variables are defined: int...Ch. 3 - What header files must be included in the...Ch. 3 - Write C++ expressions for the following algebraic...Ch. 3 - Assume a program has the following variable...Ch. 3 - Prob. 11RQECh. 3 - Write a multiple assignment statement that can be...Ch. 3 - Write a pair of multiple assignment statements...Ch. 3 - Is the following code legal? Why or why not? const...Ch. 3 - Write a cout statement that uses stream...Ch. 3 - Write a cout statement that uses stream...Ch. 3 - What header file must be included A) to perform...Ch. 3 - Pet World offers a 15 percent discount to senior...Ch. 3 - A bowling alley is offering a prize to the bowler...Ch. 3 - A retail store grants its customers a maximum...Ch. 3 - Little Italy Pizza charges 14.95 for a 12-inch...Ch. 3 - A) (Assume the user enters George Washington.)...Ch. 3 - Each of the following program segments has some...Ch. 3 - A) const int number1, number2, product; cout ...Ch. 3 - Soft Skills Often programmers work in teams with...Ch. 3 - Miles per Gallon Write a program that calculates a...Ch. 3 - Stadium Seating There are three searing categories...Ch. 3 - How Much Insurance? Many financial experts advise...Ch. 3 - Test Average Write a program that asks for five...Ch. 3 - Average Rainfall Write a program that calculates...Ch. 3 - Male and Female Percentages Write a program that...Ch. 3 - Vacation Days Write a program that prompts the...Ch. 3 - How Many Widgets? The Yukon Widget Company...Ch. 3 - How many Calories? A bag of cookies holds 30...Ch. 3 - Ingredients Adjuster A cookie recipe calls for the...Ch. 3 - Celsius to Fahrenheit Write a program that...Ch. 3 - Monthly Sales Tax A retail company muse file a...Ch. 3 - Property Tax Madison County collects property...Ch. 3 - Senior Citizen Property Tax Madison County...Ch. 3 - Math Tutor Write a program that can be used as a...Ch. 3 - Interest Earned Assuming there are no deposits...Ch. 3 - Monthly Payments The monthly payment on a loan may...Ch. 3 - Pizza Slices Joe's Pizza Palace needs a program to...Ch. 3 - How Many Pizzas? Modify the program you wrote in...Ch. 3 - Angle Calculator Write a program that asks the...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Why is the study of database technology important?
Database Concepts (7th Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
Look at the following description of a problem domain:
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Write a program that takes its input from a file of numbers of type double. The program outputs to the screen t...
Problem Solving with C++ (10th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- C++ onlyarrow_forwardC# (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_forwardc++ problemarrow_forward
- Using 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_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_forward
- Please help me in c++ languagearrow_forwardComplete the function to replace any period by an exclamation point. Ex: "Hello. I'm Miley. Nice to meet you." becomes: "Hello! I'm Miley! Nice to meet you!" 1 #include 2 #include 3 4 void MakeSentenceExcited (char* sentenceText) { /* Your solution goes here */ 456700 8} 9 10 int main(void) { 11 12 13 14 const int TEST_STR_SIZE = 50; char testStr[TEST_STR_SIZE]; fgets (testStr, TEST_STR_SIZE, stdin); 15 MakeSentenceExcited (testStr); 16 printf("%s", testStr); 17 10 notunna.arrow_forwardNeeds to be done in C# language. Problem Write a program that computes and displays the charges for a patient’s hospital stay. First, the program should ask if the patient was admitted as an in-patient or an out-patient. If the patient was an in-patient, the following data should be entered: • The number of days spent in the hospital• The daily rate• Hospital medication charges• Charges for hospital services (lab tests, etc.) The program should ask for the following data if the patient was an out-patient: • Charges for hospital services (lab tests, etc.)• Hospital medication charges The program should use two overloaded functions to calculate the total charges. One of the functions should accept arguments for the in-patient data, while the other function accepts arguments for out-patient information. Both functions should return the total charges. Input Validation: Do not accept negative numbers for any data.arrow_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_forwardQ1: Code written using language A Code written using language B Line 1: x=3 Line 2: func1 ) { print "x"; } Line 3: func2 () { Line 4: int x=9; Line 4: func1; Line 5: x-4.5 } Line 4: func1 Line 5: func2 Line 1: x=3 Line 2: func1 0{ print "x"; } Line 3: func2 () { Line 4: int x3D%3B Line 4: func%; Line 5: x=4.5 } Line 4: func1 Line 5: func2 Line 6: func1 Line 6: func1 Output: Output: No compilation errors. Running: 3 Running: 3 3 Error x is int and assigned a float value 4.5 Compare between language A and language B in terms of being 1) compiled vs. interpreted 2) imperative vs. declarative 3) object-oriented vs. non-object-oriented 4) weakly typed vs strongly typed 5) statically scoped vs. dynamically scoped [12 pt]arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
functions in c programming | categories of function |; Author: Education 4U;https://www.youtube.com/watch?v=puIK6kHcuqA;License: Standard YouTube License, CC-BY