⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eg0.cpp

📁 C++课程更学习...对于初学者很有好出
💻 CPP
字号:
// eg0.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <string.h>

// 结构体
struct Student
{
	char  m_sName[40];   // 姓名
	int   m_nID;         // 学号
	int   m_nAge;        // 年龄
	int   m_nClassNo;    // 班号 
};

void InitStudent(Student* pStu,
	char* sName, int nID,
	int nAge, int nClassNo)
{
	strcpy(pStu->m_sName, sName);
	pStu->m_nID = nID;
	pStu->m_nAge = nAge;
	pStu->m_nClassNo = nClassNo;
}

void ShowInfo(Student* pStu)
{
	printf("姓名: %s 学号:%d 年龄:%d 班号:%d\n", 
		pStu->m_sName, 
		pStu->m_nID, 
		pStu->m_nAge, 
		pStu->m_nClassNo);
}

void UnitStudent()
{
	// Nothing need to do.
}

int main(int argc, char* argv[])
{
	Student Jack;

	strcpy(Jack.m_sName, "Jack");
	Jack.m_nID = 30;
	Jack.m_nAge = 21;
	Jack.m_nClassNo = 101;

	InitStudent(&Jack, "Jack", 30, 21, 101);
	ShowInfo(&Jack);

	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -