Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++: Consider the following code segment: enum GradeLevel { FRESHMAN , SOPHMORE , JUNIOR , SENIOR }; struct Student { string first ; string middle

C++: Consider the following code segment:

enum GradeLevel { FRESHMAN, SOPHMORE, JUNIOR, SENIOR };

struct Student

{

string first;

string middle;

string last;

GradeLevel year;

float GPA;

};

Student A0012; // Student ID A0012

Student A0013; // Student ID A0013

A0012.first = "Bjarne";

A0012.last = "Stroustrup";

A0012.GPA = 3.56;

A0013 = A0012;

A0012.year = SENIOR;

A0013.middle = "C++";

A0013.year = static_castGradeLevels>(A0012.year - 2);

A0013.GPA = floor(A0012.GPA); // floor() rounds down to whole number

A0012.middle = A0013.middle.at(0) + ".";

What are the contents of the Student variables after this code has executed? Use the chart provided. Who is Bjarne Stroustrup anyway (Google it)?

Field

A0012

A0013

string first

string middle

string last

GradeLevel year

float GPA

image text in transcribed

10. (8 Points) Consider the following code segment: enum GradeLevel \{ FRESHMAN, SOPHMORE, JUNIOR, SENIOR \}; struct Student \{ string first; string middle; string last; GradeLevel year; float GPA; \}; Student A0012; // Student ID A0012 Student A0013; // Student ID A0013 A0012.first = "Bjarne" A0012.last = "Stroustrup"; A0013=A0012; AO012, year = SENIOR; A0013. middle =nC++; A0013. year = static_cast>( A0012. year 2); A0013.GPA = floor (A0012.GPA); // floor () rounds down to whole number A0012 middle = A0013.middle at (0)+nn; What are the contents of the Student variables after this code has executed? Use the chart provided. Who is Bjarne Stroustrup anyway (Google it)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

Describe the linkages between HRM and strategy formulation. page 74

Answered: 1 week ago