Home Blog Cs201 Assignment 1 Solution Spring 2022 – 100% Accurate

Cs201 Assignment 1 Solution Spring 2022 – 100% Accurate

by Usman CB
Cs201 Assignment 1 Solution Spring 2022

Are you still searching for Cs201 Assignment 1 Solution Spring 2022? If yes then Congratulations because you are at right place. Today we are going to offer you best tips and tricks to make your assignment of Cs201 Assignment 1 Solution Spring 2022 in an easy way.

Also Read:

All about Virtual University

Question for Cs201 Assignment 1 Spring 2022

Write a C++ program that performs the following tasks:

  1. Print your name, VU id, and list of courses you have selected in current semester.
  2. Print the names of all courses you have selected in the current semester.
  3. Add first numeric digit of your VU id to the total number of courses selected.
  4. Display the result of sum on the screen.
  5. Print “Welcome to CS201-Introduction to Programming” by using WHILE loop. Number of iterations of WHILE loop must be equal to sum calculated in point 4.  

For example, suppose the student id is BC123456781. Then by adding first digits of vu id=1, with number of courses (suppose =4), we get sum= 5.

Sum = first digits of vu id + number of courses

5      =       1    +    4

In this case, program should print “Welcome to CS201-Introduction to Programming” 5 times.

Sample screen shot::

Picture1

Solution for Cs201 Assignment 1 Solution Spring 2022

//CS201 Assignment No 1 2022

include

using namespace std;

int main(){

string studentName = “Zanib Bibi”;
string VU_ID = “BC210423164”;
int totalNumberOfCourse = 7, firstDigiteOfVU = 2;
int sum = 0, iter = 1;
sum = totalNumberOfCourse + firstDigiteOfVU;

cout << “My name is ” << studentName<< endl;
cout << “My VU ID is ” << VU_ID<< endl;

cout<< “\n\nCourses list in current semester” << endl;
cout << “1. Introduction to programing” << endl;
cout << “2. Digital Logic Design” << endl;
cout << “3. Business and Technical English Writing” << endl;
cout << “4. Introduction to programing Practical” << endl;
cout << “5. Calculus And Analytical Geometry” << endl;
cout << “6. Digital Logic Design Practical” << endl;
cout << “7. Introduction to Business” << endl;
cout << “\n\n Total number of courses = ” << totalNumberOfCourse << endl;
cout << “First digit of VU ID = ” << firstDigiteOfVU << endl;
cout << “Sum of First digit of VUID and total courses = ” << sum << “\n\n” << endl;
while ( iter <= sum)
{
cout << iter <<“: Welcome to CS201-Introduction to programming” << endl;
iter ++;

}

return 0;
}

Output For the Given Code of Cs201 Assignment

Screenshot 2022 06 01 124817

Note: Please Don’t Copy Paste this Code!!!

Related Posts

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.