c++ 구조체 사용

Dev_Jen
|2023. 1. 10. 23:10
반응형
#include <stdio.h>
#include <String.h>
#include <math.h>
struct Student
{
	char name[10];
	int num;
	char majer[10];
};


int main(void)
{
	struct Student lee;
	strcpy(lee.name,"이재은");
	lee.num=1971070;
	strcpy(lee.majer,"IT융합학부");
	
	printf("이름: %s\n학번: %d\n전공:%s\n",lee.name,lee.num,lee.majer); 
}
반응형

'C++' 카테고리의 다른 글

c++ 다중상속  (0) 2023.01.10
c++ 다중상속 계산기  (0) 2023.01.10
c++ swap(값 교환)  (0) 2023.01.07
c++ if문 짝수 홀수  (0) 2023.01.07
c++ 카페 관리 프로그램  (0) 2023.01.07