CS201 Assignment 2 Solution Fall 2021 - VU Answer

CS201 Assignment 2 Solution Fall 2021 by VU Answer

In This Post, Provide CS201 Assignment 2 Solution Fall 2021. Easy to See Correct CS201 Assignment No 2 Solution Fall 2021 and Download Solution File with PDF, .CPP and Word Format Below.


CS201 ASSIGNMENT 2 SOLUTION FALL 2021 


Due Date: 23 Dec 2021

Total Marks: 20


Uploading Instruction Follow:

Submit your assignment only in .cpp format


Assignment Objective:

To enable students to understand and practice the concepts of:

Data Types and Variables 

If-else statements

Repetition structure 

Loops and Operators

Arrays


Code Solution


// Provided by VU Answer


// If you need a new fresh ready assignment with your id just WhatsApp 03162965677

// We will help you perfectly


#include<iostream>


using namespace std;

int main()

{    

    char st_FirstName[20] = "Bilal"; // Student First Name

    char st_lastName[20] = "Khan"; // Student Last Name

    char st_vuId[15] = "MC190456213"; // Student ID

    int scar_size = sizeof(st_FirstName)/sizeof(st_FirstName[0]); 

int ans_size = sizeof(st_vuId)/sizeof(st_vuId[0]);

int scar_ans = 0, sumVD = 0;

    

    cout << "My First Name: " << st_FirstName << endl; // Display first Name

    cout << "My VU ID is: " << st_vuId; // Display VU ID

    

for(int i = 0; i < ans_size; i++)

{

if(st_vuId[i] >= 97 && st_vuId[i] <= 122 || st_vuId[i] >= 65 && st_vuId[i] <= 90 || st_vuId[i] >= 48 && st_vuId[i] <= 57)

{

scar_ans += 1;

}

}

    cout << "\nLast Digit of my VU ID: " << st_vuId[scar_ans - 1] << endl; // last digit of vu id print

    int l_scar = st_vuId[scar_ans - 1] - 48;

int scar = 0;

for(int i = 0; i < scar_size; i++)

{

if(st_FirstName[i] =='a' || st_FirstName[i] =='e' || st_FirstName[i] =='i' || st_FirstName[i] =='o' || st_FirstName[i]=='u' || st_FirstName[i] =='A' || st_FirstName[i] =='E' || st_FirstName[i] =='I' || st_FirstName[i] =='O' || st_FirstName[i] =='U')

{

scar += 1;

cout<<"\nVowel no " << scar << ": "<< st_FirstName[i]; // no of vowels in first name

}

}

cout << "\n";

sumVD = scar + l_scar;

cout << "\nTotal Vowels in my First Name: " << scar <<endl; // show total number of vowels in first name

cout<<""<<endl;

cout << "Sum of Vowels in first name and last digit of VUID: " << sumVD << endl;

cout << "\n";

if(sumVD % 2 == 0)

{

for(int i = 0; i < sumVD; ++i)

{

cout << " Iteration no: " << i + 1 << endl; 

cout << "My First Name is: " << st_FirstName << endl;

}

}

else

{

for(int i = 0; i < sumVD; ++i)

{

cout << " Iteration no: " << i + 1 << endl; 

cout << "My Last Name is " << st_lastName << endl;

}

}


    return 0;

}


OUTPUT



CS201 Assignment 2 solution fall 2021 output




Download CS201 Assignment 2 Solution Fall 2021 .CPP File


Download CS201 Assignment 2 Solution Fall 2021 PDF File


Download CS201 Assignment 2 Solution Fall Word File



Check Also:







PLEASE NOTE:

Don't copy-paste the same answer.

Make sure you can make some changes to your solution file before submitting copy-paste solution will be marked zero.

Before submitting an assignment check your assignment requirement file.

If you need some help and question about file and solutions.


Share with fellows

Post a Comment

0 Comments