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주세요 수다님들 부탁드립니다~
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2654930 | 도와주십시요 ㅜㅜ 자료구조 ㅜㅜ | 도널드 | 2024-05-15 |
2654881 | PID 모듈 검색 부분 질문합니다 . | 이름없음 | 2024-05-14 |
2654850 | 조건에 만족하는 다음 수를 찾고 싶습니다. | 초엘 | 2024-05-14 |
2654790 | 두파일간 byte단위 txt파일 복사 中 | 슬찬 | 2024-05-14 |
2654768 | 사전만들기 입니다. | 여우By | 2024-05-13 |
2654716 | c언어 고수님들 답좀적어주세요 급합니다 ㅠㅠ | 한말글 | 2024-05-13 |
2654688 | c언어 ㅠㅠ 너 무 어려 워요 ㅠ 도와주세요!! | 별빛 | 2024-05-13 |
2654659 | 구구단 소스 궁금한 점 도움 부탁드립니다! (2) | 미련곰팅이 | 2024-05-12 |
2654633 | 오류가 무었인가요..? (2) | 단순랩퍼 | 2024-05-12 |
2654603 | 어디가 잘못된지를 모르겠습니다. 한 번 봐주세요...ㅠ (2) | 글고운 | 2024-05-12 |
2654574 | 소스 추가좀 부탁드립니다. (등수 출력) | 크리미걸 | 2024-05-12 |
2654550 | 피보나치수열. (3) | 중독적 | 2024-05-11 |
2654521 | c초보 빙고관련게임... | 달콤이 | 2024-05-11 |
2654491 | 10진수를 2진수로 바꾸는법 (8) | 아잉 | 2024-05-11 |
2654412 | 빅오를 구하고 싶어요~ | 애기 | 2024-05-10 |
2654381 | 혼자 연구하는 c/c++ 질문 | 아잉 | 2024-05-10 |
2654352 | 행렬크기를 scanf로 입력받을수도 있나요..? | VanilLa | 2024-05-10 |
2654293 | 첫시작값과 끝값의 사이에 존재하는 정수들의 합을 구하는 것 (5) | 해긴 | 2024-05-09 |
2654185 | 64bit 환경에서 자료형의 크기가 좀궁그해요(완료) 더궁금한게 생겻어요(추가) (2) | 빈길 | 2024-05-08 |
2654152 | 확장자 exe로 변경 (1) | 한 | 2024-05-08 |