I appreciate any help here, Please proivide breif explination: (1) What is the d
ID: 2265996 • Letter: I
Question
I appreciate any help here, Please proivide breif explination:
(1) What is the declaration for a C-style string that can hold a name with up to three printable characters (e.g., “Ron”)?
(2) The following code fragment _____.
struct student
{
string name;
double gpa;
};
student thisStudent;
cout << “Enter this student’s name: “ << flush;
cin >> thisStudent.name;
cout << “Enter this student’s GPA: “ << flush;
cin >> thisStudent.gpa;
student nextStudent = thisStudent;
(3) Given the following code to fill an array, what should the value of X be?
int X;
int data[100];
for(int i = 0; i <= X; i++)
data[i] = i;
(4) Which of the following statements calls the following function correctly?
int MultiplyValues (int, int);
(5) Which of the following functions is taking an array of MyStruct structures as a pass-by-value parameter?
int name [3];Explanation / Answer
1) Char Name[3] - it allocates for 3 character variables
2) Causes a run time error because the code
student thisStudent;
cout << “Enter this student’s name: “ << flush;
cin >> thisStudent.name;
cout << “Enter this student’s GPA: “ << flush;
cin >> thisStudent.gpa;
student nextStudent = thisStudent;
proper class object creation is not happened.
3) X=99. This value gives 100 array values to data;
4) int a = MultiplyValues (int x, int y) is the correct declaration for the given function definition
5) void MyFunc(MyStruct *data[]); will take values
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.