You are on page 1of 4

Earl Jehrard L.

Penamora

G021 Comp Prog

Create C++ program using string and Array statements


Create a program that will:
1. Accept a "word"
2. Place each letter of the "word" into an array
3. Display each letter, except "vowels"
Present a flowchart or pseudo for your [1] algorithm. Then the [2] source code of your
program.
 
Algorithm Pseudocode

1: Initialize the variables


2: Accept the input
3: Initialize for loop
4: Check and delete the vowels
5: Store the string without vowels using another loop
6: Terminate both for loop
7: Print the string without vowels
2. Source Code
#include<iostream>

#include<string.h>

#include<stdio.h>

using namespace std;

int main()

char str[50],str1[50];

int len, i, j;

cout<<"\nEnter any string :: ";

gets(str);

strcpy(str1,str);

len=strlen(str);

for(i=0; i<len; i++)

if(str[i]=='a' || str[i]=='e' || str[i]=='i' ||

str[i]=='o' || str[i]=='u' || str[i]=='A' ||

str[i]=='E' || str[i]=='I' || str[i]=='O' ||

str[i]=='U')

for(j=i; j<len; j++)

str[j]=str[j+1];

len--;

i--;

}
}

cout<<"\nString without Vowels = "<<str;

cout<<endl;

return 0;

You might also like