.11 Lyca mobile 10:52 AM bbhosted.cuny.edu 59% Programming Assignment number Two
ID: 3592629 • Letter: #
Question
.11 Lyca mobile 10:52 AM bbhosted.cuny.edu 59% Programming Assignment number Two If this item does not open automatically you can open Programming Assignment number Two here CS 13 Fall 2017 P programming assignment 2017-10-4 Completed working program due by: Monday October 16,2017 before 10:00pm or this assigement email your program to philip.listowsky@kbec.cuny.edu IMPORTANT Your email SURJECT must be: C$13 STRUCT your last name Write a C+program that will demonstrate that you know how to use STRUCT Create a new struct type called "student The student struct must have at least 5 member items of your cheosing Create two instances of student: one for full time students, one for part time students Create code that populates your struct instances with data, allows retrieval of that data and has functionality entirely of your choosing (be creative!). You should include the ability te change student status (upper/lower Freshman, upperlower Sophomore) This is an open-ended creative assignment. How exactly your program performs and what it does is up to you (with the parameters described above followed). The main thing is to DEMONSTRATE, by your code, that you "get how to use structsExplanation / Answer
#include <iostream>
using namespace std;
struct student
{
char name[50];
int roll;
float marks;
int student_type;
char status[20];
} s[5];
int main()
{
cout << "Enter information of students: " << endl;
// storing information
for(int i = 0; i < 6; ++i)
{
s[i].roll = i+1;
cout << "For roll number" << s[i].roll << "," << endl;
cout << "Enter name: ";
cin >> s[i].name;
cout << "Enter marks: ";
cin >> s[i].marks;
cout << "Enter student type 1 for full tyme and 2 for part time: ";
cin >> s[i].student_type;
cout << "Enter staus as : upper freshmen, lower freshmen ,upper sophomor and lower sophomore: ";
cin >> s[i].status;
cout << endl;
}
cout << "Displaying Information: " << endl;
// Displaying information
for(int i = 0; i < 6; ++i)
{
cout << " Roll number: " << i+1 << endl;
cout << "Name: " << s[i].name << endl;
cout << "Marks: " << s[i].marks << endl;
cout << "Type: " << s[i].student_type << endl;
cout << "Type: " << s[i].status << endl;
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.