Computer Science, asked by Shubhankar09, 9 months ago

write a program in Java to accept 10 cities in SDA. Display only those number which begin with condiment and ends with vowel.

Answers

Answered by Anonymous
0

Answer:

// C++ program to accept String

// starting with Vowel

#include <iostream>

using namespace std;

// Function to check if first character is vowel

int checkIfStartsWithVowels(string str)

{

if (!(str[0] == 'A' || str[0] == 'a'

|| str[0] == 'E' || str[0] == 'e'

|| str[0] == 'I' || str[0] == 'i'

|| str[0] == 'O' || str[0] == 'o'

|| str[0] == 'U' || str[0] == 'u'))

return 1;

else

return 0;

}

// Function to check

void check(string str)

{

if (checkIfStartsWithVowels(str))

cout << "Not Accepted\n";

else

cout << "Accepted\n";

}

// Driver function

int main()

{

string str = "animal";

check(str);

str = "zebra";

check(str);

return 0;

Similar questions