The More I Help Others To Succeed, The More I Succeed

CS201 Assignment Solution # 2nd Fall 2021

65 CS201 Assignment Solution # 2nd Fall 2021

CS201 Assignment Solution # 2nd Fall 2021

Instructions

It should be clear that your assignment will not get any credit if:

• Assignment is submitted after due date.
• Submitted assignment does not open or file is corrupt.
• Assignment is copied (From internet/students).

The recommended tool to develop Assignment

Dev C++

Objectives:

To enable students to understand and practice the concepts of:

• Data Types and Variables
• If-else statements
• Repetition structure
• Loops and Operators
• Arrays

Assignment Submission Instructions

You have to submit only.CPP file on the assignments interface of CS201 from your LMS account. Assignment submitted in any other format will be scaled with zero marks. So, check your solution file format before submission.

Assignment

In this assignment you will write a program which will display vowels (a,e,i,o,u) in your name and the total count of vowels in your name. After determining total number of vowels in your name you will add the total number of vowels and your student Id’s  last digit,

1. Declare two char type arrays for student’s first name and student’s VU ID.
2. Display Student name and ID as show in Figure 1.
3. Display last digit of Student ID as show in Figure 1.
4. Find and display vowels (a,e,i,o,u) in your first name.
5. Find total number of vowels (a,e,i,o,u) in your first name.
6. Display each deducted vowel as shown in as show in Figure 1.
7. Calculate SumVD as::SumVD = total numbers of vowels  + last digit of your student ID.
1. If value of sumVD is even, print your first name ‘n’ times. (Value of “n” is equal to SumVD)
2. If value of sumVD is odd, print your last name ‘n’ times. (Value of “n” is equal to SumVD)

Note: Student’s first name, Student VUID and last digit of students VUID should be hardcoded in your program.

Sample screenshot:

include

using namespace std;

int main()
{
char firstName[] = “Your First Name Here”;
char lastName[] = “Your Last Name Here”;
char VUID[] = “Your VUID Here”;
int lastDigit = 0; // last digit of vuid
int vowels = 0;

cout << "My First Name : " << firstName << endl;
cout << "My VU ID : " << VUID << endl;
cout << "Last Digit of my VU ID : " << lastDigit << endl
<< endl
<< endl;

for (int i = 0; firstName[i] != '\0'; ++i)
{
if (firstName[i] == 'a' || firstName[i] == 'e' || firstName[i] == 'i' ||
firstName[i] == 'o' || firstName[i] == 'u' || firstName[i] == 'A' ||
firstName[i] == 'E' || firstName[i] == 'I' || firstName[i] == 'O' ||
firstName[i] == 'U')
{
++vowels;
cout << "Vowel No " << vowels << " : " << firstName[i] << endl;
}
}

int total = vowels + lastDigit;
cout << "\nTotal Vowels in my First Name : " << vowels << endl;
cout << "Sum of vowels in first name and last digit of VUID : " << total << endl
<< endl
<< endl;

if (total % 2 == 0)
{
for (int i = 1; i <= total; i++)
{
cout << "Iteration no : " << i << endl;
cout << "My First name is " << firstName << endl;
}
}
else
{
for (int i = 1; i <= total; i++)
{
cout << "Iteration no : " << i << endl;
cout << "My last name is " << lastName << endl;
}
}

return 0;

}

For More Assignment Details

CS201 Assignment Solution # 2nd Fall 2021#CS201 Assignment Solution # 2nd Fall 2021#CS201 Assignment Solution # 2nd Fall 2021 