write a class with name “STRING”.Assume only studio.h library is included and it is not possible to include any other library. In PRIVATE section of class there will be a character array (lets say S) and also it is possible to locate functions to this section that you want to use but not asked. In public section there will be five functions.
SOLUTION CODE
#include<studio.h>
using namespace std;
class STRING {
private:
char S;
public:
char set_S [6] = {'S','T','R','I','N','G'};
//cout<<S[0] <<"\n";
string count (string S) {
int res = 0;
for (int i=0;i<6;i++)
//if (S[i] == S)
res++;
//return res;
}
void showCharacterType(string S)
{
int vowels = 0;
for (int j = 0; j < S.length(); j++) {
char S;
if ( (S >= 'S' && S <= 's') ||
//(T >= 'T' && T <= 't') ||
//(R >= 'R' && R <= 'r') ||
//(I >= 'I' && I <= 'i') ||
//(N >= 'N' && N <= 'n') ||
//(G >= 'G' && G <= 'g') ) {
S = tolower(S);
vowels++;
}
cout << "Vowels: " << vowels << endl;
int main()
{
string str = ‘STRING’;
countCharacterType(str);
str.erase ([0]);
return 0;
}
}
}
}
}
Comments
Thank you so much , really helpfull website , really good
Leave a comment