- 论坛徽章:
- 0
|
请高手看一下以下代码,很简单的,可是为什么我编译之后会有3个提示呢?提示如下:
Compiling...
Cpp1.cpp
C:\Documents and Settings\aministrator\桌面\Cpp1.cpp(2 : warning C4101: 'string' : unreferenced local variable
C:\Documents and Settings\aministrator\桌面\Cpp1.cpp(29) : warning C4101: 'intptr' : unreferenced local variable
C:\Documents and Settings\aministrator\桌面\Cpp1.cpp(32) : warning C4700: local variable 'password' used without having been initialized
Linking...
Cpp1.exe - 0 error(s), 3 warning(s)
兄弟们可以告诉我一下,为什么会出现这3个提示吗?怎么解决呢?小弟在这谢谢啦
#include "iostream.h"
#include "stdio.h"
#include "stdlib.h"
class group_1
{
public:
void find(void);
};
group_1 everyone;
class group_2
{
public:
void add(void);
void modify(void);
};
group_2 select_few;
class group_3
{
public:
void add(void);
void modify(void);
void remove(void);
};
group_3 heath;
void main(void)
{
char string[2],option='\0';
int i,*intptr;
char *password,*charptr;
cout<<"please enter password: ";
charptr=gets(password);
i=atoi(charptr);
while(option!='q')
{
cout<<"please enter option:\n";
cout<<"<a>dd,<f>ind,<m>odify,<d>elete or <q>uit:";
cin>>option;
switch(option) {
case 'a':
if(i==10||i==20)
{
select_few.add();
}
else if (i=99)
{
heath.add();
}
else
cout<<"permission denied!\n";
break;
case 'f':
everyone.find();
break;
case 'm':
if(i==10||i==20)
{
select_few.modify();
}
else if (i==99)
{
heath.modify();
}
else
cout<<"permission denied!\n";
break;
case 'd':
if(i==99)
heath.remove();
else
cout <<"permission denied!\n";
break;
case 'q':
break;
default:
cout<<"invalid input ! please re-enter. \n";
}
}
}
void group_1::find(void)
{
cout<<"inside group1 find() \n";
}
void group_2::add(void)
{
cout<<"inside group2 add() \n";
}
void group_2::modify(void)
{
cout<<"inside group2 modify() \n";
}
void group_3::add(void)
{
cout<<"inside group3 add() \n";
}
void group_3::modify(void)
{
cout<<"inside group3 modify() \n";
}
void group_3::remove(void)
{
cout<<"inside group3 remove() \n";
} |
|