#include <iostream.h>
class Ming
{
public:
int transform1(char letter); //小写字母转换为数字
int transform2(char letter); //大写字母转换为数字
char transform3(int data); //数字转换为小写字母
char transform4(int data); //数字转换为大写字母
char transform(char letter) ; //明文变密文
};
int Ming:: transform1(char letter)
{int d;
d=letter-97;
return d;
}
int Ming::transform2(char letter)
{int d;
d=letter-65;
return d;
}
char Ming::transform3(int data)
{char letter;
letter=data+97;
return letter;
}
char Ming::transform4(int data)
{char letter;
letter=data+65;
return letter;
}
void transform(char letter)
{
int d1,d2;
if(letter<=122&&letter>=97) { d1=transform1(letter);
d2=3*d1+1;
cout<<transform3(d2);}
if(letter<=90&&letter>=65) { d1=transform2(letter);
d2=3*d1+1;
cout<<transform4(d2);}
}
void main()
{
Ming m;
char le;
cin>>le;
cout<<m.transform1(le);
}
错误:
Compiling...
fangshe.cpp
E:\c++\C++课件(2006-2007第二学期)\mima\fangshe.cpp(38) : error C2065: 'transform1' : undeclared identifier
E:\c++\C++课件(2006-2007第二学期)\mima\fangshe.cpp(40) : error C2065: 'transform3' : undeclared identifier
E:\c++\C++课件(2006-2007第二学期)\mima\fangshe.cpp(41) : error C2065: 'transform2' : undeclared identifier
E:\c++\C++课件(2006-2007第二学期)\mima\fangshe.cpp(43) : error C2065: 'transform4' : undeclared identifier
执行 cl.exe 时出错.
fangshe.exe - 1 error(s), 0 warning(s)
请问一下怎么改啊?麻烦哪位指点一下啊!