728x90

프로그래머의 삶 Programmer's Life/C & C++ 51

태양계 모델링 - 태양 지구 달 금성 수성 까지만 ( OpenGL활용 )

#include #include #include static int Day=0,Time=0,Day2=0,Day3=0; void MyDisplay(){ glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0.1,0.1,0.1,0.1,0.0,0.0,1.0,1.5,0.0); // 전체 모델을 기울임 glColor3f(1.0,0.3,0.3); // 태양의 색 glutWireSphere(0.13,20,16); // 태양을 그려냄 glPushMatrix(); // 태양기준의 좌표계를 스택에 푸시하여 저장 glRotatef((GLfloat) Day,0.0,1.0,0.0); glTranslatef(0.45,0.0,0...

아랫거랑 유사...- _-;삽질한거같아 다시 짜봄;;

#include #include #include typedef struct{ int sn; char *name; }student; student *std; int n=0; void inputd(student *std) { if(nsn); (std+n)->name=(char*)malloc(sizeof(char)); printf("Input Name:"); scanf("%s",(std+n)->name); n++; } else { printf("memory full\n"); } } void outd(student *std) { int a; for(a=0;asn,(std+a)->name); } } void main() { int a; std=(student *)malloc(sizeof(student)*3); w..

단순....입력받아 출력...구조체 연습중..

#include #include #include typedef struct{ char *name; char *sn; int escore; int mscore; }student; student *record; int n=0; void inputdata(student *ptr) { if(n >= 3) { printf("Memory Full~\n"); } else { (ptr+n)->name=(char *)malloc(sizeof(char)); (ptr+n)->sn=(char *)malloc(sizeof(char)); printf("Input data\n"); printf("Name : "); scanf("%s",(ptr+n)->name); printf("School Number : "); scanf("%s"..

728x90