0% found this document useful (0 votes)
16 views

Programing

The document contains C++ code that declares variables for a name, last name, and VUID. It then counts and prints the vowels in the name, calculates a total from the vowels and last digit of the VUID, and conditionally prints either the first or last name based on if the total is even or odd.

Uploaded by

Rai Hessy
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Programing

The document contains C++ code that declares variables for a name, last name, and VUID. It then counts and prints the vowels in the name, calculates a total from the vowels and last digit of the VUID, and conditionally prints either the first or last name based on if the total is even or odd.

Uploaded by

Rai Hessy
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<iostream>

using namespace std;


main()
{
char name[]="Ali";
char lastname[]="Raza";
char VUID[]="MC210400207";

int lastdigit=0;

int vowels = 0;

cout<<"My name is Ali"<<name<<endl;


cout<<"My VUID is : "<<VUID<<endl;
cout<<"Last digit of my VUID is :"<<lastdigit<<endl;

for(int i=0;name[i]!='\0';i++)
{
if(name[i] =='a' || name[i] =='e' || name[i] =='i' ||
name[i] =='o' || name[i] =='u' || name[i] =='A' ||
name[i] =='E' || name[i] =='I' || name[i] =='O' ||
name['U'] )
{
vowels++;
cout<<"Vowels No"<<vowels<<":"<<name[i]<<endl;
}
}
int total = vowels + lastdigit;
cout<<"\nTotal Vowels in my first name :"<<vowels<<endl;
cout<<"Sum of vowels in my name and VUID is :"<<total<<endl;

if(total %2==0)
for(int i=1;i<=total;i++)
{
cout<<"\nIteration no :"<<i<<endl;
cout<<"My first name is "<<name<<endl;
}
else
{

for(int i=1;i<=total;i++)
cout<<"\nIteration no :"<<i<<endl;
cout<<"My last name is "<<lastname<<endl;
}
return 0;
}

You might also like