//i want to convert a string in to uppercase
// but it gives me an error:
//could not find a match for 'toupper(charT)(string)' in function main()
//could somebody explain what the error meant and give me a solution tnx..
#include<string.h>
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
void main()
{
int i, iNumberInput;
clrscr();
cout <<"Enter number of inputs: \n";
cin >> iNumberInput;
int* iNumber = new(nothrow) int[iNumberInput];
string* sName = new(nothrow) string[iNumberInput];
i=0;
clrscr();
for(int x=0;x<iNumberInput;x++,i++)
{
cout << "please input the following data!" << endl << endl;
cout << "Enter a number input ."<< (i+1) << endl;
cin >> iNumber[x];
cout << "Enter a name input ."<< (i+1) << endl;
cin >> sName[x];
clrscr();
}
cout << "you are done with the inputs!" << endl << endl;
cout << "The following are: " << endl << endl;
for(int x=0;x<iNumberInput;x++)
{
cout << sName[x] << " is "<< iNumber[x] << " years old." << endl;
}
cout << endl;
for(int x= 0;x<iNumberInput;x++){
for(int d = iNumberInput;d>x;d--){
if(iNumber[x]>iNumber[d]){
cout << sName[x] << " is older that " << sName[d] <<"." << endl;
}}}
cout << endl;
for(int x= 0;x<iNumberInput;x++){
for(int d = iNumberInput;d>x;d--){
if(iNumber[x]>iNumber[d]){
cout << sName[d] << " is " << (iNumber[x]-iNumber[d]) << " years younger than " << sName[x] <<"." << endl;
}}}
cout << endl;
for(int x=0;x<iNumberInput;x++)
{
cout<< "there are " << sName[x].length() <<" characters in: " << sName[x]<< endl;
}
cout << endl;
int d=0;
string rave = sName[0];
for(int x=0;x<iNumberInput-1;x++,d++){
cout << "uppercase of " << sName[d] <<" is: "<< toupper(sName[d+1]) << endl;
sName[d] = sName[d+1];
if(x==iNumberInput-2)
{
cout << "uppercase of " << sName[d] <<" is: "<< toupper(rave) << endl; // <=
}} // this part
sName[d] = rave;
cout << endl;
d=iNumberInput-1;
string rave2 = sName[d];
for(int x=0;x<iNumberInput-1;x++,d--){
cout << "lower of " << sName[d] <<" is: "<< tolower(sName[d-1]) << endl; // <=
sName[d]= sName[d-1]; // this part
if(d==1)
{
cout << "lowers of " << sName[d] <<" is: "<< tolower(rave2) << endl;// <=
} // this part
}
delete [] sName;
delete [] iNumber;
}
How is he meant to know? Do you expect him to go downloading some compiler he's possibly never heard of?
If "tc++" is a standards-compliant compiler, it will work. What compiler do you use "at home"?
helios and duoas when i put your codes it gives me and error
my code gives me a error: could not find a match for 'toupper(charT)(string)' in function main()
helios gives an error: colud not find a match for trasform(InputIterator,OutputIterato,UnaryOperation)(char *,char *,char *,charT (*)(charT,const locale &))' function main()
duoas gives me a error: cannot generate template specialization for toupper(int), in function uppercase(const string)
colud not find a match for ptr_fun(Arg1,Arg2,Result)(charT (*)(charT,const locale &))' function uppercase (const string &)
colud not find a match for trasform(InputIterator,OutputIterato,BinaryOperation)(const char *,const char *,char *,undefined )' in function uppercase(const string &)
could not find a match for 'toupper(charT)(string)' in function main()
// im using the cmd as may complire so the txt error here is not copy paste
// maybe i forgot some thing or im missing some thing in may codes?
helios gives an error: colud not find a match for trasform(InputIterator,OutputIterato,UnaryOperation)(char *,char *,char *,charT (*)(charT,const locale &))' function main()