م
ماهينور
Guest
هذا السؤال
1. Define class called Vowel which has the following:
2. Private data members: num that represent number of lines, and ch that represents the character to be found.
3. Set and Get member functions which allow assigning and returning each data member in the class. For every data member there are Set and Get functions.
4. A Constructor function that initializes the data members by using set functions.
5. Define a member function numVowel() that read and print number of vowels in all lines. [Hint: use nested loop: outer for loop, inner while loop]
6. Define member function findChar() that read one line and print the location of the first appearance of ch, if not, print "The text you entered doesn't have ch"
7. Define member function Validate(int) that validate the integer if it is positive or not; if not, prompt the user to reenter it again and then return the correct positive number.
[Hint: Validate(int) should used by set member functions before setting data member to any value – use While loop]
هذا جوابي وبقولكم وش اللي ناقص
2. Private data members: num that represent number of lines, and ch that represents the character to be found.
3. Set and Get member functions which allow assigning and returning each data member in the class. For every data member there are Set and Get functions.
4. A Constructor function that initializes the data members by using set functions.
5. Define a member function numVowel() that read and print number of vowels in all lines. [Hint: use nested loop: outer for loop, inner while loop]
6. Define member function findChar() that read one line and print the location of the first appearance of ch, if not, print "The text you entered doesn't have ch"
7. Define member function Validate(int) that validate the integer if it is positive or not; if not, prompt the user to reenter it again and then return the correct positive number.
[Hint: Validate(int) should used by set member functions before setting data member to any value – use While loop]
هذا جوابي وبقولكم وش اللي ناقص
Rich (BB code):
#include <iosream>
using namespace std;
class Vowel
{
private:
int num;
char ch;
public:
Vowel(int x,char y)
{
setnum(x);
setchar(y);
}
void setnum(int x)
{
num=validate(x);
}
void setch(char y)
{
ch=y;
}
int getnum()
{
return num;
}
int getch()
{
return ch;
}
int validate(int x)
{
while (x<0)
{
cout<<"enter a number";
cin>>x
}
return x;
}
void numvowel()
{
cin.get(2);
char c;
c=cin.get();
for (int i=1;i<=num;i++)
{
while(c=="\n")
swich(c)
{
int sum=0;
case 'a': sum++;
case 'o': sum++;
case 'i': sum++;
case 'u': sum++;
case 'e': sum++;
}
c=cin.get();
}
cout<<"the number of vowel is: "<<sum;
}
الكلاس ماخلص ... اللي ناقصي من السؤال هذا
Define member function findChar() that read one line and print the location of the first appearance of ch, if not, print "The text you entered doesn't have ch"
7.
انا في الانتظااااار