Professional Documents
Culture Documents
GROUP 5 C++ Assignemt
GROUP 5 C++ Assignemt
GROUP 5 C++ Assignemt
Group Assignment
Name Id RU/14
Submitted to:Haimanot T.
#include<iostream>
int main(){
cin>>mat[i][j]; }
for (i=0;i<3;i++){
for (j=0;j<2;j++){
mat2[i]+=mat[i][j]; }
return 0;
2: Develop a C++ program that accepts the name of a person and then counts how many vowels
the person’s name has.
#include<iostream>
#include<string>
int numofvowels=0;
string userstring="";
getline(cin,userstring);
if((userstring[i]==('a'))||(userstring[i]==('e'))||(userstring[i]==('i'))||(userstring[i]==('o'))||
(userstring[i]==('u')) )
numofvowels=numofvowels+1;}
cout<<numofvowels<<endl;
return 0;
3: Write a C++ program that accepts a word from the user and then displays the world after
reversing it.
#include <iostream>
#include <string.h>
int main() {
int i, j, k, len;
cin.getline(str,100);
len = strlen(str);
k = i - 1; }
else {
k = i;
while (k > j) {
temp = str[j];
str[j] = str[k];
str[k] = temp;
j++;
k--;
j = i + 1;
return 0;