CS201 : Introduction to Programming

CS201 Introduction to Programming Assignment no 3

This topic contains 2 replies, has 2 voices, and was last updated by  Googie.pk 3 days, 7 hours ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6394

    Cyberian
    Keymaster
    Points: 128

    XYZ University needs a system for student’s courses and their semester details. A data entry operator needs to enter student’s data in to the system, and then the system will show the report of student semester information. Following data will be used by the system.
    • Course code
    • Course name
    • Semester
    The system will allow entering data for five courses at a time and will input course code along with course name, later the system will format the report in a more readable form.
    Your task is to:
    Write a C++ program to implement the above mentioned interface
    • Your program should provide the user with options to enter data for courses along with course code. e.g.
    Enter course name along with course code: CS201 Introduction to Programming
    • After taking course information from user your program should prompt user to enter semester information.
    e.g. Enter Semester: Fall 2016
    • The program should input data for five courses and semester.
    • Use structure name “course” in your program.
    • Use separate functions for taking user inputs, displaying and formatting outputs.
    e.g. Input Courses(),Display Header(),Display Courses(),Format Course(—) etc.
    Note: Use structure to implement above program, no credit will be awarded if structure is not used.
    last date 16 jan 2017

    #6426

    Googie.pk
    Participant
    Points: 226
    #6478

    Googie.pk
    Participant
    Points: 226
    /* CS201 Assignment solution.
    DK Studies
    */
    
    #include<iostream>
    #include<cstring>
    using namespace std;
    void displayheaders();
    void inputcourse();
    void displayer(string a[5],string b[5],string c[5],string d[5]);
    struct uni{
    		string course;
    		string semesters;
    		
    	};
    int main(){
    	
    
    inputcourse();
    	}
    void  displayheaders(){
    
    cout<<"# \tcourse code\t  course name \t semester \t lounching year"<<endl;
    cout<<"------------------------------------------------------------------------"<<endl;
    }
    void inputcourse()
    {
    	uni name[5];
    	string Ccode[5];
    	string Syear[5];
    	string coursename[5];
    	string semsfall[5];
    	
    for (int i=0; i<5; i++)
    {
    cout<<"Enter the name of the course along with course code: ";
    getline(cin,name.course);
    
    cout<< "Enter Semester: ";
    getline(cin,name.semesters);	
    
    Ccode= name.course.substr(0,5);
    Syear = name.semesters;
    coursename= name.course.substr(5);
    semsfall=  name.semesters.substr(name.semesters.size()-4);	
    }
    displayheaders();
    displayer(Ccode,Syear,coursename,semsfall);	
    	
    }
    
    void displayer(string a[5],string b[5],string c[5],string d[5])
    {
    for(int i= 0;i<5; i++)
    {
    	cout<<i+1<<"\t"<<a<<"  \t"<<c<<"\t"<<b<< "\t\t "<<d<<endl;
    	}	
    	}
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.