C++소스하고있는데요~~ 꼭 봐주세요!!
봄바람
#includeiostream
#includewindows.h//system(cls)
#includestring
#includeconio.h//getchar
#includestdlib.h//난수
#includetime.h//난수 시간 변화
using namespace std;
void gotoxy(int x, int y)
{
coord pos={x,y};
setconsolecursorposition(getstdhandle(std_output_handle), pos);
}
//학생 클래스
class student
{
int desk;
bool pro;
/*
bool gla;
int heig;
bool spo;
bool wa;
*/
public:
student()
{
/*
gla=0;
heig=0;
spo=0;
*/
pro=0;
desk=0;
//wa=0;
}
/*
void number(int n)
{
num=n;
}
void glass()
{
gla=1;
}
void height(int h)
{
heig=h;
}
void sports()
{
spo=1;
}
*/
void problem(int desk_num)
{
pro=1;
desk=desk_num;
}
/*
void want()
{
wa=1;
}
void glass_print()
{
if(gla==1)
{
coutnumber. numendl;
number++;
y_p++;
}
}
void heig_print()
{
if(st[i]-heig!=0)
{
coutnumber. heigcmendl;
number++;
y++;
}
}
void spo_print()
{
if(st[i]-spo==1)
{
coutnumber. numendl;
number++;
y++;
}
}
*/
bool pro_test()
{
if(pro==0)
{
return false;
}
else
{
return true;
}
}
void desk_in(int i)
{
desk=i;
}
void pro_print()
{
coutdeskendl;
}
int desk_print()
{
return desk;
}
};
void main()
{
int n, a, b, s, i, std_num, desk_num;
int *desk;
int *test_desk;
srand(time(null));
//학생수 입력
cout학생 수 입력 [ ];
gotoxy(14,0);
cinn;
//책상 줄,열 입력
system(cls);
gotoxy(2,0);
cout줄;
gotoxy(0,1);
cout열[ ][ ][ ][ ][ ][ ];
gotoxy(2,2);
cout[ ][ ][ ][ ][ ][ ];
gotoxy(2,3);
cout[ ][ ][ ][ ][ ][ ];
gotoxy(0,5);
cout==================================================;
gotoxy(0,6);
cout책상의 줄과 열을 입력해 주세요. 줄[ ]\t열[ ];
gotoxy(35,6);
cina;
gotoxy(43,6);
cinb;
//책상 1차원 배열 생성
desk=(int*)malloc(sizeof(int)*(a*b));
//test용 책상 배열 생성
test_desk=(int*)malloc(sizeof(int)*(a*b));
/*
//책상 배열 생성
desk=(int**)malloc(sizeof(int)*a);
for(i=0;ia;i++)
{
desk[i]=(int*)malloc(sizeof(int)*b);
}
*/getch();
student *st[100];
for(i=0;in;i++)
{
st[i]=new student();
}
while(1)
{
//메인화면
system(cls);
cout1. 안경쓴 사람 입력\n;
cout2. 키 입력\n;
cout3. 운동부 입력\n;
cout4. 문제아 자리 지정\n;
cout5. 앞자리 원하는 사람 지정\n;
cout6. 자리 배치\n;
cout7. 저장 데이터 비우기\n;
cout8. 종료\n;
gotoxy(0,8);
cout==================================================\n;
cout원하는 기능을 선택하세요. ;
cins;
cin.ignore();
switch(s)
{
case 4:
{
system(cls);
while(1)
{
//테스트용 배열 입력
for(i=0;in;i++)
{
test_desk[i]=i+1;
}
//테스트용 출력
system(cls);
for(i=0;in;i++)
{
cout[;
if(test_desk[i]/10==0)
{
cout0;
}
couttest_desk[i];
cout] ;
if(i%b==b-1)
{
coutendl;
}
}
cout\n==================================================\n;
cout[ ]번 학생을 [ ]번 책상에 앉힙니다. (뒤로 가려면 0 입력);
gotoxy(1,a+1);
cinstd_num;
if(std_num==0)
{
break;
}
gotoxy(15,a+1);
cindesk_num;
st[std_num]-problem(desk_num);
}
getch();
break;
}
case 6:
{
system(cls);
for(i=0;in;i++)
{
if(!(st[i]-pro_test()))
{
st[i]-desk_in(rand()%37+1);
}
for(int j=0;ji;j++)
{
if(st[i]-desk_print()==st[j]-desk_print())
{
i--;
break;
}
}
&}
}
for(i=0;in;i++)
{
cout[;
if(st[i]-desk_print()/10==0)
{
cout0;
}
coutst[i]-desk_print();
cout] ;
if(i%b==b-1)
{
coutendl;
}
}
}
case 8:
{
exit(0);
}
//모두 아닐 때 main으로
default:
{
system(cls);
gotoxy(0,10);
cout잘못된 입력입니다.endl;
break;
}
}
}
}
이소스를 하면, 끝에 입력은 다되는데, 화면출력이 안됩니다 문제점을 찾아주시고 앞으로 운동부나 안경쓴사람 자리배열도 hint주세요 수다님들 부탁드립니다~