Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 2.2, Problem 13STE
Program Plan Intro
New-line character and tab character in C++:
New-line character:
- A new-line character is represented by “\n” in C++
programming .- This character is used for new line.
- To start a new output line, user can include \n in a quoted string.
- User can use “endl” to start a new output line.
Example:
The example for new-line character is shown below:
cout << "Programming Exercises\n"
<< "C++ Programming: \n";
Tab character:
- A tab character is represented by “\t” in C++ programming.
- This character implies the horizontal tab.
Example:
The example for tab character is shown below:
cout << "BookName"<< "\t"<<"AuthorName\n";
The above statement is used to display the given string horizontally.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
can you please write comment and draw a flow chart for this code
Give an output statement that produces the letter 'A', followed by the newline character, followed by the letter 'B', followed by the tab character, followed by the letter 'C'.
Using the print function, print "Happy Earth Day".
Chapter 2 Solutions
Problem Solving with C++ (10th Edition)
Ch. 2.1 - Give the declaration for two variables called feet...Ch. 2.1 - Give the declaration for two variables called...Ch. 2.1 - Give a C++ statement that will change the value of...Ch. 2.1 - Give a C++ statement that will increase the value...Ch. 2.1 - Give a C++ statement that will change the value of...Ch. 2.1 - Prob. 6STECh. 2.1 - Prob. 7STECh. 2.2 - Give an output statement that will produce the...Ch. 2.2 - Give an input statement that will fill the...Ch. 2.2 - Prob. 10STE
Ch. 2.2 - Write a complete C++ program that writes the...Ch. 2.2 - Write a complete C++ program that reads in two...Ch. 2.2 - Prob. 13STECh. 2.2 - Write a short program that declares and...Ch. 2.3 - Convert each of the following mathematical...Ch. 2.3 - Prob. 16STECh. 2.3 - What is the output of the following program lines...Ch. 2.3 - Write a complete C++ program that reads two whole...Ch. 2.3 - Given the following fragment that purports to...Ch. 2.3 - What is the output of the following program lines...Ch. 2.4 - Write an if-else statement that outputs the word...Ch. 2.4 - Suppose savings and expenses are variables of type...Ch. 2.4 - Write an if-else statement that outputs the word...Ch. 2.4 - Write an if-else statement that outputs the word...Ch. 2.4 - Consider a quadratic expression, say x2 x 2...Ch. 2.4 - Consider the quadratic expression x2 4x + 3...Ch. 2.4 - What is the output of the following cout...Ch. 2.4 - What is the output produced by the following (when...Ch. 2.4 - What output would be produced in the previous...Ch. 2.4 - What is the output produced by the following (when...Ch. 2.4 - What is the output produced by the following (when...Ch. 2.4 - What is the most important difference between a...Ch. 2.4 - What is the output produced by the following (when...Ch. 2.4 - Write a complete C++ program that outputs the...Ch. 2.5 - The following if-else statement will compile and...Ch. 2.5 - Prob. 36STECh. 2.5 - Write a complete C++ program that asks the user...Ch. 2 - A metric ton is 35,273.92 ounces. Write a program...Ch. 2 - The Babylonian algorithm to compute the square...Ch. 2 - Many treadmills output the speed of the treadmill...Ch. 2 - Write a program that plays the game of Mad Lib....Ch. 2 - The following is a short program that computes the...Ch. 2 - A government research lab has concluded that an...Ch. 2 - Workers at a particular company have won a 7.6%...Ch. 2 - Modify your program from Programming Project 2 so...Ch. 2 - Negotiating a consumer loan is not always...Ch. 2 - Write a program that determines whether a meeting...Ch. 2 - Prob. 6PPCh. 2 - It is difficult to make a budget that spans...Ch. 2 - You have just purchased a stereo system that cost...Ch. 2 - Write a program that reads in ten whole numbers...Ch. 2 - Modify your program from Programming Project 9 so...Ch. 2 - Sound travels through air as a result of...Ch. 2 - Prob. 12PPCh. 2 - The HarrisBenedict equation estimates the number...Ch. 2 - Write a program that calculates the total grade...Ch. 2 - It is important to consider the effect of thermal...Ch. 2 - Prob. 16PP
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
- Code with comments and output screenshot is must. I will Upvote. Thank you!arrow_forwardWhich of the following options is rigth for the following declaration: string *x,y; Select one: a.y is a pointer to a string, x is a string b.x is a pointer to a string, y is a string c.none of the options d.both x and y are pointers to string typesarrow_forwardUse C++ language Avoid cryptic variable names and poor indentations.arrow_forward
- Task 1: Working with the cout StatementExercise 1: Retrieve program name.cpp from the Lab 2 folder.Fill in the code so that the program will do the following:Write your first and last name on one line.Write your address on the next line (recall the function of the endl statement).Write your city, state and zip on the next line.Write your telephone number on the next line.Remember that to output a literal, such as “Hello”, you must use quotes.Compile and run the program.Example: Deano Beano123 Markadella LaneFruitland, Md. 55503489-555-5555The code for name.cpp is as follows: // This program will write the name, address and telephone// number of the programmer.// PLACE YOUR NAME HERE#include <iostream>using namespace std;int main(){// Fill in this space to write your first and last name// Fill in this space to write your address (on new line)// Fill in this space to write you city, state and zip (on new line)// Fill in this space to write your telephone number (on new line)return…arrow_forwardPlease read all the instructions. The output should be like in the 2nd picture and the green colored words should user inputs. Please show all the codes of EV_driver.cpp, EV.cpp, EV.h files + the 2 outputs. Please give as pictures and also as text writingarrow_forwardCreate a function that calculates the following mathematical expression: z = 3x + r +y* +em(x)arrow_forward
- 2. Complete the function avg5 to return the average of five numbers. Use the accumulator pattern. Don't change anything outside of avg5. Save & Run 10/4/2020, 1:04:36 PM - 13 of 13 3 def avg5(num1, num2, num3, num4, num5): '''Returns the average of its parameters' pass #This statement does nothing = you can remove it #Your code here to calculate the average 4 5 use the accumulator pattern 7 avgstart=num1 8 avg5=(avgstart+num2+num3+num4+num5)/5 return avg5 9. 10 11 12 13 14 15 print(avg5(10, 13, 15, 18, 25)) 16arrow_forwardCode with comments and output screenshot is must for an Upvote. Thank you!arrow_forwardI provided the print statements. They need to be exact. Could you please add some comments to the codearrow_forward
- Need python help running code and others. Functions are ideal for use in menu-driven programs. When the user selects an item from a menu, the program can call the appropriate function. Write a menu-driven program for Burgers. Display the food menu to a user (Just show the 5 options' names and prices - No need to show the details!) Use numbers for the options and the number "6" to exit. If the user enters "6", your code should not ask any other questions, just show a message like "Thank you, hope to see you again!" Ask the user what he/she wants and how many of them. (Check the user inputs) Keep asking the user until he/she chooses the exit option. Use a data structure to save the quantities of the orders. You should use ArrayLists/Array Bags, or LinkedLists/LinkedBags (one or more of them) to save data. Calculate the price. Ask the user whether he/she is a student or a staff. There is no tax for students and a 9% tax for staff. Add the tax price to the total price.…arrow_forwardQ1/ A-Design a program to calculate the value of (M) from the equation below: M=C. √B Where: n-18 100, C-810¹, 8-0.12*10*x-30. Create a (label) object and a (Text Box) object for each input and output parameters of the equation and two (Command Buttons), one for exit from the program and the other one is for making the calculations.?arrow_forwardwhich string function will change the case of the supplied parameters? a) Argument b) Lower c) Desc d) Fromarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning