dimanche 13 décembre 2020

The out put console shows nothing

This is the program of removing all the vowels from the given string. My code does not show any output in the console.

#include <bits/stdc++.h>
using namespace std;
int isVowel(char ch)
{
    if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')
    return 1;
    else 
    return 0;
}

int main()
{
    string str,str1;
    getline(cin,str);
    int index=0;
    for(int i=0;str[i]!='\0';i++)
    {
        if(isVowel(str[i])==0)
        str1[index++]=str[i];
    }
    str1[index]='\0';
    //strcpy(str,str1);
    cout<<str1;

    return 0;
}

This is the code.

Aucun commentaire:

Enregistrer un commentaire