Consider the following program: //rq17-8.cpp #include int main() { using namespace std; char ch; int ct1 =
Question:
Consider the following program:
//rq17-8.cpp
#include
int main()
{
using namespace std;
char ch;
int ct1 = 0;
cin >> ch;
while (ch != 'q')
{
ct1++;
cin >> ch;
}
int ct2 = 0;
cin.get(ch);
while (ch != 'q')
{
ct2++;
cin.get(ch);
}
cout << "ct1 = " << ct1 << "; ct2 = " << ct2 << "\n";
return 0;
}
What does it print, given the following input:
I see a q
I see a q
Here signifies pressing the Enter key.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 50% (10 reviews)
ct1 3 ct2 0 ct1 is incremented for ea...View the full answer
Answered By
Tamondong Riza
Professionally, I am a teacher with years of experience tutoring math and science, as well as teaching in both public schools and independent schools. I feel that education should be an enlightening experience for all children, and I'm committed to helping my students learn new skills and make progress in their subjects.
0.00
0 Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
Consider the following program segment, where i, j, k, n, and counter are integer variables and the value of n (a positive integer) is set prior to this segment. counter : = 0 for i : = 1 to n do for...
-
Consider the following program that uses binary search to check whether the input array contains a speci c input value, and the 4 tests, and answer the following questions. t1:{1,2,3}, 2 t2:{1,2,3},...
-
Consider the following program in Scheme: What does this programprint? What would it print if Scheme used dynamic scoping and shallow binding? Dynamic scoping and deep binding? Explain your answers....
-
If the Albany highway system described in Problem 29 has revised flow capacities as shown in the following network, what is the maximal flow in vehicles per hour through the system? How many vehicles...
-
The text Web site contains data on interest rates for Treasury bonds. For the most recent data, compare the rates on 10-year conventional bonds and 10-year inflation- indexed bonds. What do these...
-
A firm is considering the following investment project: The project has a 5-year useful life with a $125,000 salvage value, as shown. Double declining balance depreciation will be used, assuming the...
-
A healthcare company decides to market a hand warmer. It is basically a palm-size plastic pouch containing a supersaturated aqueous salt solution; that is, the amount of dissolved salt exceeds its...
-
1. Evaluate the problem-definition process. Has the problem been defined adequately so that a relevant decision statement can be written? 2. What research questions might be tested? 3. What might a...
-
Oriole Company has the following production data for selected months. Ending Work in Process Beginning Month Work in Process Units Transferred Out % Complete as to Units Conversion Cost January -0-...
-
In the preliminary design of a furnace for industrial boiler, methane at 25?C is burned completely with 20% excess air, also at 25?C. The feed rate of methane is 450k mol/h. The hot combustion gases...
-
Both of the following statements read and discard characters up to and including the end of a line. In what way does the behavior of one differ from that of the other? while (cin.get() != ' ')...
-
Here is part of a program that reads keyboard input into a vector of string objects, stores the string contents (not the objects) in a file, and then copies the file contents back into a vector of...
-
Consider the line y = 0 + 1 x. (i) Let (x 1 , y 1 ) and (x 2 , y 2 ) be two points on the line. Show that (x, y) is also on the line, where x = (x 1 + x 2 )/2 is the average of the two values and y...
-
A Supermarket Megamerger Will Redefine What You Buy at the Grocery Store Kroger and Albertsons want to merge in a $20 billion deal. If antitrust regulators approve, the definition of a grocery store...
-
Using this video answer the following questions https://www.youtube.com/watch?v=oet62-F2Q9c 1. Using examples either from the video or your own research, what are some ways in which the American...
-
Pinnacle Plastics Products (PPP) need to make a choice between gas-powered and electric-powered forklifts. Gas-powered forklifts have an initial cost of $21,500, an AOC of $550, and can be sold for...
-
The "depreciation tax shield" measures a company's tax savings, in a given year, from being able to deduct depreciation expenses from taxable income (i.e., the amount that your total taxes decrease...
-
How can organizations minimize time, situational, and activity constraints that create biases when assessing the extent to which employees have made progress in achieving developmental goals. Discuss...
-
What are the equivalence classes of the bit strings in Exercise 30 for the equivalence relation R4 from Example 5 on the set of all bit strings? (Recall that bit strings s and t are equivalent under...
-
Write a paper about how diet relates to breast cancer in women study design to use: case control study purpose & rationale the purpose of this final project is to utilize the methods and...
-
Write down the binary representation of the decimal number 63.25 assuming the IEEE 754 single precision format.
-
Write down the binary representation of the decimal number 63.25 assuming the IEEE 754 double precision format.
-
Write down the binary representation of the decimal number 63.25 assuming it was stored using the single precision IBM format (base 16, instead of base 2, with 7 bits of exponent).
-
The weekly salaries (in dollars) of 24 randomly selected employees of a company are shown below: 310 320 450 460 470 500 520 580 600 650 700 540 710 840 870 900 1000 1200 1250 1300 1400 1720 2500...
-
(a) Assume a non-dividend paying asset St, undergoes geometric Brownian motion dS = S+dt+S+dWt where W is a standard Brownian motion and and are constants. We assume also that r, the risk-free...
-
Eleanor is auditing a large manufacturing company. Currently, she is looking at the entire population of inventory purchases for the year, and matching the purchase order, receiving documentation,...
Study smarter with the SolutionInn App