hi!
can you help me with this program pls!
write a c++ prog that:
- declare an array named gamma of type char.
- declare an array named vowels of type char.
- prompt the user to input n characters in the array gamma.
- define a func named savevowels that determines and return the num of vowels letters in the gamma array and save them in the vowels array.
thanks, both of you!
i still just cant figure out the way i can define the array without declaring its size !!all the ways above didn't work! i do not know the size , the size will get declared when the user stops inserting the characters.. i'm still not sure about this ! ill really be grateful if you try to reexplain this part. like should i try the "dynamic allocation " thing to define the array ?
Are you certain that you must use a C++ array? If so then you need to declare an array that's big enough to hold the largest input that expect. For example: char gamma[10000];
But this sort of programming is rightfully frowned upon. What if the user wants to enter 10008 characters instead of 10,000? This is how you create a security flaw called a "buffer overrun"
If allowed, you should use C++'s standard string class instead.
Can you post the exact text of the assignment? Small choices in wording are often significant to how you should solve the problem.
write a c++ program that:
- declares an array named gamma of type char.
- declares an array named vowels of type char.
- prompts the user to input n characters in the array gamma.
- defines a function named savevowels that determines and return the number of vowels [a,e,u,i,o] letters in the gamma array and save them in the vowels array.