Carefully consider the following program: #include using namespace std; int main() { char ch; int ct1, ct2;
Question:
Carefully consider the following program:
#include
using namespace std;
int main()
{
char ch;
int ct1, ct2;
ct1 = ct2 = 0;
while ((ch = cin.get()) != '$')
{
cout << ch;
ct1++;
if (ch = '$')
ct2++;
cout << ch;
}
cout <<"ct1 = " << ct1 << ", ct2 = " << ct2 << "\n";
return 0;
}
Suppose you provide the following input, pressing the Enter key at the end of each
line:
Hi!
Send $10 or $20 now!
What is the output? (Recall that input is buffered.)
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 60% (10 reviews)
The output is as follows i If the whileloop condition is true then the salutation is printed ...View the full answer
Answered By
James Warinda
Hi! I’m James Otieno and I'm an experienced professional online tutor with countless hours of success in tutoring many subjects in different disciplines. Specifically, I have handled general management and general business as a tutor in Chegg, Help in Homework and Trans tutor accounts.
I believe that my experience has made me the perfect tutor for students of all ages, so I'm confident I can help you too with finding the solution to your problems. In addition, my approach is compatible with most educational methods and philosophies which means it will be easy for you to find a way in which we can work on things together. In addition, my long experience in the educational field has allowed me to develop a unique approach that is both productive and enjoyable.
I have tutored in course hero for quite some time and was among the top tutors awarded having high helpful rates and reviews. In addition, I have also been lucky enough to be nominated a finalist for the 2nd annual course hero award and the best tutor of the month in may 2022.
I will make sure that any student of yours will have an amazing time at learning with me, because I really care about helping people achieve their goals so if you don't have any worries or concerns whatsoever you should place your trust on me and let me help you get every single thing that you're looking for and more.
In my experience, I have observed that students tend to reach their potential in academics very easily when they are tutored by someone who is extremely dedicated to their academic career not just as a businessman but as a human being in general.
I have successfully tutored many students from different grades and from all sorts of backgrounds, so I'm confident I can help anyone find the solution to their problems and achieve
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 which provides a software approach to mutual exclusion: Integer array control [1: N]; integer k Where 1 k N, and each element of control is either 0, 1, Or 2. All...
-
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},...
-
Create a 3-panel informational brochure on threats to government computer systems and the potentials effects of these threats. To create your brochure, you can use brochure builder or another program...
-
Using Figure 2-8 as a guide, identify two structured processes and two dynamic processes at your university. -Explain how the degree of structure varies in these processes. -How do you think change...
-
A cable company decides to provide Internet access over cable in a neighborhood consisting of 5000 houses. The company uses a coaxial cable and spectrum allocation allowing 100 Mbps downstream...
-
The numbers of stolen bases during the 2016 season for Chicago Cubs players who stole at least one base are listed. 2 8 3 2 13 12 6 2 1 5 11 1 Determine whether the data are qualitative or...
-
Haifa Instruments, an Israeli producer of portable kidney dialysis units and other medical products, develops an 8-month aggregate plan. Demand and capacity (in units) are forecast as shown in the...
-
The following is a summary of the transactions for the year: a. Provided services, $108,000, of which $32,400 was on account and the balance was received in cash. b. Collected on accounts receivable,...
-
Discuss how the digital revolution is impacting the way marketers plan and implement their integrated marketing communications programs. Identify three specific technological developments and discuss...
-
Write a precursor to a menu-driven program. The program should display a menu offering four choices, each labeled with a letter. If the user responds with a letter other than one of the four valid...
-
Write a program that reads up to 10 donation values into an array of double. (Or, if you prefer, use an array template object.) The program should terminate input on non-numeric input. It should...
-
The work done by one mole of a monatomic ideal gas ( = 5/3) in expanding adiabatically is 825 J. The initial temperature and volume of the gas are 393 K and 0.100 m3. Obtain (a) The final temperature...
-
1. What is an Ad Idea? How does it impact your creative? 2. Explain an advertisement that you love, or find online. How does the creative and copy power the underlying message for that brand/product?...
-
Explain how a salesperson can influence purchasing. Respond to the following scenario: Your copier needs to be repaired. You have money to replace it, so you call a salesperson. The salesperson tells...
-
Where do your products/services fit in the market? How do they compare to those of your competitors? How do customers benefit from your products/services? Place strategy Channel Product/ services...
-
Everything you know about the surface of the planet is based on your interpretation of this digital image. Would you land your spacecraft on this place? Why or why not
-
A True Platform For Sellers: How Alibaba Is Trying to Take Over The World 1. How is Alibaba seeking to facilitate each stage in the B2B buying process? 2. What methods is Alibaba using to build its...
-
Consider a 3-year zero-coupon bond with a face value of $100 and a yield of 4% (annually compounded). Compute this bond's modified duration, dollar duration, and DVBP.
-
At 31 December 20X9, the end of the annual reporting period, the accounts of Huron Company showed the following: a. Sales revenue for 20X9, $ 2,950,000, of which one- quarter was on credit. b....
-
WriteVerilog code to implement the function f (x 1 , x 2 , x 3 ) = m(1, 2, 3, 4, 5, 6) using the gate-level primitives. Ensure that the resulting circuit is as simple as possible.
-
(a) Use a schematic capture tool (which can be downloaded from the Internet; for example, from www.altera.com) to draw schematics for the following functions f 1 = x 2 x 3 x 4 + x 1 x 2 x 4 + x 1 x 2...
-
Consider the logic expressions Prove or disprove that f = g. f = X XX5 + X X X 4 X 5 + X X X 4 X 5 8 = X2 X3 X4 X X 3 X 4 X 5 + X1 X3 X4 X5 + X X X 3 X 4 + X X X 4 X 5 + X X X3 X5 + X2 X3 X4 X5 +...
-
1. Write a Java program that will prompt the user for a number and print out a square with those dimensions. For example, if the user enters 5, return the following: * * * ** ** * * * * * * * * * * *...
-
2. Vector multiplication or dot product is performed by multiplying corresponding elements and summing the products. It can be represented mathematically as oa; *bi where a and b are vectors of...
-
The following data was collected from an experiment testing the hypothesis: The density of cream whipped for 5 minutes increases at higher altitudes. What would be an acceptable interpretation of...
Study smarter with the SolutionInn App