A few c++ questions
1) In order to use the string data type in a program, you must include the ____ directive in your program. 1. #include <iostream> 2. #include <iomanip> 3. #include <string> 4. using namespace std; 2) The _____ function allows you to access any number of characters contained in a string variable. 1. remove 2. getline 3. substr 4. partial 3) Which one of the following options represents the output of the program below? struct pixel { int c, r; }; void display(pixel p) { cout << "col "<< p.c << " row " << p.r << endl; } int main() { pixel x = {40,50}, y, z; z = x; x.c += 10; y = z; y.c += 10; y.r += 20; z.c -= 15; display(x); display(y); display(z); return 0; } 1. Col 50 Row 50 Col 50 Row 70 Col 25 Row 50 2. Col 40 Row 40 Col 40 Row 70 Col 25 Row 50 3. Col 60 Row 50 Col 60 Row 80 Col 25 Row 50 4. Col 50 Row 70 Col 50 Row 55 Col 25 Row 50 4) Consider the following statements: struct studentType1 { string name; int ID; float gpa; }; struct studentType2 { string name; int ID; float gpa; }; studentType1 student1, student2; studentType2 student3, student4; Which of the following statements is valid in C++? 1. student2.ID = ID; 2. student2 = student3; 3. student1 = student4; 4. student1.ID = student3.ID; 5) Consider the following statements: struct rectangleData { float length; float width; float area; float perimeter; }; rectangleData bigRect; rectangleData smallRect; Which of the following statements is legal in C++? 1. if (bigRect == smallRect) 2. if (bigRect != smallRect) 3. if (bigRect.length == width) 4. if (bigRect.length == smallRect.width) 6) Consider the following statements: struct circleData { float radius; float area; float circumference; }; circleData circle; Which of the following statements is valid in C++? 1. cin >> circle.radius; circle.a