Compare commits

...

2 Commits

Author SHA1 Message Date
deyuanw a61df274f5 5
2 years ago
deyuanw 43d87b23be 3
2 years ago

@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "C:/mingw64/bin/gcc.exe",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}

@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": true,
"cwd": "c:/Users/王德沅/c/test1",
"program": "c:/Users/王德沅/c/test1/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

@ -0,0 +1,38 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wconversion",
"-Wnull-dereference",
"-Wsign-conversion"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false
}

90
daima

@ -0,0 +1,90 @@
#define NAME_LEN 31
#define MAX_PARTS 100
//保存学生成绩信息的结构
struct students
{
int number;
char name[NAME_LEN + 1];
int score;
};
static struct students stu[MAX_PARTS];
static int num_parts = 0;
#include <stdio.h>
#include <stdlib.h>
//定义常量
#define CMD_QUIT 0
#define CMD_QUERY 4
#define CMD_INSERT 5
#define CMD_UPDATE 6
#define CMD_DELETE 7
#define CMD_READ 1
#define CMD_SAVE 2
#define CMD_PRINT 3
#define CMD_SORT 8
#define CMD_CHART 9
// 菜单命令的编号
// 函数声明
void init(void);
void quit(void);
void display_menu(void);
int make_choice(void);
void read_data(void); // 读取
void save_data(void); // 保存
void print_data(void); // 打印
void query_data(void); // 查询
void add_data(void); // 添加
void update_data(void); // 修改
void delete_data(void); // 删除
void sort_data(void); // 排序
void make_chart(void); // 图表
int confirm(const char *msg);
// 主程序
int main(void)
{
init(); // 程序启动
while (1)
{
display_menu();
int c = make_choice();
switch (c)
{
case CMD_QUERY:
query_data();
break;
case CMD_INSERT:
add_data();
break;
case CMD_UPDATE:
update_data();
break;
case CMD_DELETE:
delete_data();
break;
case CMD_READ:
read_data();
break;
case CMD_SAVE:
save_data();
break;
case CMD_PRINT:
print_data();
break;
case CMD_SORT:
sort_data();
break;
case CMD_CHART:
make_chart();
break;
default:
puts("命令错误,请重新选择");
break;
case CMD_QUIT:
if (confirm("确定要退出吗?"))
quit(); // 仅在确认后退出
break;
}
}
return 0;
Loading…
Cancel
Save