1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
int test(string r ){
const int arraySize = 10;
char array2[arraySize2] ={'A','B','E','F','G','H','J','K','N','O','P','Q','R','S','T','U','W','Y','Z'};
for(int cntr = 0; cntr <r.length(); cntr++)
if(!isdigit(r[cntr])){
for(int new1 =0; new1<arraySize2;new1++)
for(int cntr1 = 0; cntr1 <r.length(); cntr1++)
if(array2[new1] == r[cntr1]){
return 2; //will return2 when it finds the same
// char in the array and the string r.
}
else{
return 3; //will return 3 when there is a char
//in the string which isnt in the array
}
}
else {
return 1; // will return 1 when string is all digit.
}
int main()
{
string r = "11D";
test(r);
if(test(r) == 1)
{
cout << "ALL ARE DIGITS" << endl;
}
if (test(r)== 2)
{
cout << "There is an important alphabet in the program." << endl;
}
if (test(r)== 3)
{
// testRoman(r);
cout << "THERE IS AN ALPHABET IN THE STRING WHICH IS NOT IN THE ARRAY" << endl;
}
}
|