

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Chapter 4 warm up exercises If input data are 10 20 30 40 50 60 10 20 30 40 50 60 10 20 30 40 50 60 70 80 and the input statements are: cin >> a >> b >> c; cin.ignore(100, โ\nโ); cin.get(ch1); cin >>d >>e >>f; cin.ignore(100, โ\nโ); cin.ignore(100, โ\nโ); cin >> a >> b; what is produced by cout << a <<โ โ <<b <<endl; cout << c <<โ โ <<d <<โ โ<<e<<endl; cout <<f<<endl; What is the effect of the following statements? String coco; isfstream inFile; infile.open(โdatafile.datโ); getline(infile, coco); Suppose a file named bobo.data contains only a collection of whole numbers. Write the statements necessary to read all the data from the file and output the number of items in the file.
Chapter 5 warm up exercises Suppose int1 has the value 12, int2 has the value 18, and int3 has the value 21. What is the result of each of the following boolean expressions? a. int1 < int2 && int2 < int b. int1 > int2 && int2 < int c. int1 > int2 || int2<int d. int1 <= int2 โ 6 e. int1++ <= int2 - f. int2 <= int1 + 5 || int3 >= int2 + 5 g. !( int1 < 30 ) h. !(int2 == int1 && int3 > int1) i. !(int1 > 25) && (int1 < 17) Suppose x is of type int, what values of x make the following evaluate to true? ! ((x < 12) || (x >23)) !( x > 5 && x <7 ) What is the value of each of the following? โAโ < โBโ โaโ < โbโ โaโ < โBโ Suppose a, b, and x are of type int Which of the following expressions is preferable? a = b/x && x != 0 x != 0 && a = b/x x != 0 || a = b/x