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
Textbook Question
Chapter 8.1, Problem 13STE
Consider the following code (and assume it is embedded in a complete and correct
char a[80], b[80];
cout << “Enter sone input:\n”;
cin >> a >> b;
cout << a << ‘–’ << b <<“END OF OUTPUT\n”;
If the dialogue begins as follows, what will be the next line of output?
Enter some input:
The
tine is now.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
1. The Intermediate code generated below is for a given statement M=p*q+r/s is as follows:
T1 = id5
T2 = id4 / T1
T3 = id3+T2
T4 = idz*T3
M= T4
Write the output for code optimization and Code generation.
please help with this code in C language
Create a program using C++ that satisfies the following requirements: SAMPLE ATTACHED
Develop a function called "randomPairsGenerator" that generates and displays pairs of random numbers, with a maximum of 5 pairs per line.
Within this function, use a loop to create 20 pairs of random numbers:1) The first number in each pair should be within the range of 1 to 50, inclusive.2) The second number in each pair should be within the range of 51 to 100, inclusive.
For each pair, print the two numbers side by side, separated by a space. Separate each pair with a comma.
After every 5 pairs, start a new line.
After all 20 pairs have been generated, display the total count of pairs in which the sum of the two numbers is divisible by 7.
Chapter 8 Solutions
Problem Solving with C++ (10th Edition)
Ch. 8.1 - Prob. 1STECh. 8.1 - What C string will be stored in singingString...Ch. 8.1 - What (if anything) is wrong with the following...Ch. 8.1 - Suppose the function strlen (which returns the...Ch. 8.1 - Prob. 5STECh. 8.1 - How many characters are in each of the following...Ch. 8.1 - Prob. 7STECh. 8.1 - Given the following declaration and initialization...Ch. 8.1 - Given the declaration of a C-string variable,...Ch. 8.1 - Write code using a library function to copy the...
Ch. 8.1 - What string will be output when this code is run?...Ch. 8.1 - Prob. 12STECh. 8.1 - Consider the following code (and assume it is...Ch. 8.1 - Consider the following code (and assume it is...Ch. 8.2 - Consider the following code (and assume that it is...Ch. 8.2 - Prob. 16STECh. 8.2 - Consider the following code: string s1, s2...Ch. 8.2 - What is the output produced by the following code?...Ch. 8.3 - Is the following program legal? If so, what is the...Ch. 8.3 - What is the difference between the size and the...Ch. 8 - Create a C-string variable that contains a name,...Ch. 8 - Prob. 2PCh. 8 - Write a program that inputs a first and last name,...Ch. 8 - Write a function named firstLast2 that takes as...Ch. 8 - Write a function named swapFrontBack that takes as...Ch. 8 - Prob. 6PCh. 8 - Write a program that inputs two string variables,...Ch. 8 - Solution to Programming Project 8.1 Write a...Ch. 8 - Write a program that will read in a line of text...Ch. 8 - Give the function definition for the function with...Ch. 8 - Write a program that reads a persons name in the...Ch. 8 - Write a program that reads in a line of text and...Ch. 8 - Write a program that reads in a line of text and...Ch. 8 - Write a program that can be used to train the user...Ch. 8 - Write a sorting function that is similar to...Ch. 8 - Redo Programming Project 6 from Chapter 7, but...Ch. 8 - Redo Programming Project 5 from Chapter 7, but...Ch. 8 - Prob. 11PPCh. 8 - Write a program that inputs a time from the...Ch. 8 - Solution to Programming Project 8.14 Given the...Ch. 8 - Write a function that determines if two strings...Ch. 8 - Write a program that inputs two strings (either...Ch. 8 - Write a program that manages a list of up to 10...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Why is it useful for a programmer to have some background in language design, even though he or she may never a...
Concepts Of Programming Languages
What is the difference between main memory and secondary storage?
Starting Out With Visual Basic (8th Edition)
(Greatest Common Divisor) The greatest common divisor (GCD) of two integers is the largest integer that evenly ...
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Look at the following classes: public class Ground { public Ground() { System.out.println(You are on the ground...
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Write a summary list of the problem-solving steps identified in the chapter, using your own words.
BASIC BIOMECHANICS
In Exercises 55 through 60, find the value of the given function where a and b are numeric variables of type Do...
Introduction To Programming Using Visual Basic (11th 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
- (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.arrow_forward(Statistical) In many statistical analysis programs, data values considerably outside the range of the majority of values are simply dropped from consideration. Using this information, write a C++ program that accepts up to 10 floating-point values from a user and determines and displays the average and standard deviation of the input values. All values more than four standard deviations away from the computed average are to be displayed and dropped from any further calculation, and a new average and standard deviation should be computed and displayed.arrow_forward(Numerical) a. The following is an extremely useful programming algorithm for rounding a real number to n decimal places: Step 1: Multiply the number by 10n Step 2: Add 0.5 Step 3: Delete the fractional part of the result Step 4: Divide by 10n For example, using this algorithm to round the number 78.374625 to three decimal places yields: Step1:78.374625103=78374.625 Step2:78374.625+0.5=78375.125 Step3:Retainingtheintegerpart=78375Step4:78375dividedby103=78.375 Using this algorithm, write a C++ function that accepts a user-entered value and returns the result rounded to two decimal places. b. Enter, compile, and run the program written for Exercise 11a.arrow_forward
- (Numerical) Heron’s formula for the area, A, of a triangle with sides of length a, b, and c is A=s(sa)(sb)(sc) where s=(a+b+c)2 Write, test, and execute a function that accepts the values of a, b, and c as parameters from a calling function, and then calculates the values of sand[s(sa)(sb)(sc)]. If this quantity is positive, the function calculates A. If the quantity is negative, a, b, and c do not form a triangle, and the function should set A=1. The value of A should be returned by the function.arrow_forwardMark the following statements as true or false: a. To use a predefined function in a program, you need to know only the name of the function and how to use it. (1) b. A value-returning function returns only one value. (2, 3) c. Parameters allow you to use different values each time the function is called. (2, 7, 9) d. When a return statement executes in a user-defined function, the function immediately exits. (3, 4) e. A value-returning function returns only integer values. (4) f. A variable name cannot be passed to a value parameter. (3, 6) g. If a C++ function does not use parameters, parentheses around the empty parameter list are still required. (2, 3, 6) h. In C + + , the names of the corresponding formal and actual parameters must be the same. (3, 4, 6) i. A function that changes the value of a reference parameter also changes the value of the actual parameter. (7) j. Whenever the value of a reference parameter changes, the value of the actual parameter changes. (7) k. In C++, function definitions can be nested; that is, the definition of one function can be enclosed in the body of another function. (9) l. Using global variables in a program is a better programming style than using local variables, because extra variables can be avoided. (10) m. In a program, global constants are as dangerous as global variables. (10) n. The memory for a static variable remains allocated between function calls. (11)arrow_forwardDefine the function: int power (int base, int exp) {/*It accepts the arguments for base and exponent and returns power. The algorithm is to repeatedly multiply the value of the base to how many times the value of exponent. Test the function inside main(). Write the complete C program. */} For example: Intput. Result 2 32 5arrow_forward
- example the name is Jack Robert , ID 53605 in C language. thank youarrow_forward3. A decimal integer number N can be converted into Binary form, using the following recursive algorithm: Decimal_To_Binary(N) If N = 0 or N = 1 Print N Else Decimal_To_Binary(N/2) Print N mod 2 Write the complete C++ program using the above pseudocode for the function Decimal_To_Binary and the main function. Main should call this program suitably sending user inputs for N and make sure to run the program with a value of N in the range (1) between 1 and 15 (11) in the range from 24 to 29 and (111) in the range from 51 to 60arrow_forward4- The function sum_n_avg computes the sum and the average of three input arguments and relays its results through two output parameters. a) Write a prototype for a function sum_n_avg that accepts three double-type input parameters and returns two output parameters through reference (the sum and average). b) Write the function definition for function sum_n_avg. The function definition is where the actual computations are performed. c) Write a function call in main () for sum_n_avg. The function call can look like below: { double one, two, three, sum_of_3, avg_of_3; printf("Enter three numbers> "); scanf ("%lf%lf%lf", &one, &two, &three); sum_n_avg (, }arrow_forward
- Refer to Code Segment 1 and Code Segment 2. Assume variables have been declared accordingly with their appropriate data type; and value for n is user supplied. Line numbers are provided for easy referencing. Line Code Segment 1 (1) (2) (3) (4) (5) (6) for i = 1 to n { for j = 1 to n { val = i*j print val Line Code Segment 2 (1) (2) (3) (4) (5) (6) for i = 1 to n *n { r = (i-1) /n c = (i-1) % n val = (r+1) * (c+1) print val Answer the questions below: 1. Both Code Segments 1 and 2 perform the same task AND the execution time of Code Segment 1 scales slower than the execution time of Code Segment 2 as we increase n. Write TRUE if the statement is true, FALSE otherwise. 2. In Code Segment 1, how many times will line 4 be executed in terms of n? 3. In Code Segment 2, how many times will line 5 be executed in terms of n?arrow_forwardSolve in c programming languagearrow_forwardPlease do the following in OCAML language and try to complete the program fully and without errors. Problem 1 Now in a similar fashion to plus (using apply_n), define expon a function that takes the first argument to the power of the second argument. ` let expon a b = (** YOUR CODE HERE **)` Example: expon 4 5 (** => 1024 **)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Introduction to Operators in C; Author: Neso Academy;https://www.youtube.com/watch?v=50Pb27JoUrw;License: Standard YouTube License, CC-BY