// Solved by Abdul Hadi E Services
#include<iostream>
using namespace std;
int main()
{
char st_FirstName[20] = "Abdul Hadi "; // Student First Name
char st_lastName[20] = "E Services"; // Student Last Name
char st_vuId[15] = "BC200201121"; // 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')
{
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;
}
Download Free CS201 Assignment 2 in CPP File
Want more info, please press the below button
`
0 Comments
Please write us. Please write in detail that how may we help you