#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
typedef struct Exam
{
char question[1024];
char A[100];
char B[100];
char C[100];
char D[100];
char correct;
}Exam;
Exam questions[1000];
int count;
void input_question()
{
system("cls");
printf("***************************************************************************\n");
printf("* 试题录入与添加 *\n");
printf("***************************************************************************\n");
printf("请输入题目:");
gets(questions[count].question);
fflush(stdin);
printf("请输入选项 A:");
gets(questions[count].A);
fflush(stdin);
printf("请输入选项 B:");
gets(questions[count].B);
fflush(stdin);
printf("请输入选项 C:");
gets(questions[count].C);
fflush(stdin);
printf("请输入选项 D:");
gets(questions[count].D);
fflush(stdin);
printf("请输入正确答案:");
questions[count].correct = getchar();
fflush(stdin);
count++;
printf("录入试题成功!");
getch();
void deletep()
{
int i;
system("cls");
printf("***************************************************************************\n");
printf("* 试题删除 *\n");
printf("***************************************************************************\n");
printf("请输入要删除题目:");
}
如何把缓冲区内指定选题删除?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- CSDN专家-天际的海浪 2022-05-27 01:16关注
参考下
void deletep() { int i,j; system("cls"); printf("***************************************************************************\n"); printf("* 试题删除 *\n"); printf("***************************************************************************\n"); printf("请输入要删除题目:"); char q[1024]; gets(q); fflush(stdin); for (i = 0; i < count; i++) { if (strcmp(q, questions[i].question)==0) { for (j = i; j < count-1; j++) { questions[j] = questions[j+1]; } count--; break; } } printf("删除题目成功!"); getch(); }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 C#算法问题, 不知道怎么处理这个数据的转换
- ¥15 YoloV5 第三方库的版本对照问题
- ¥15 请完成下列相关问题!
- ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
- ¥15 求daily translation(DT)偏差订正方法的代码
- ¥15 js调用html页面需要隐藏某个按钮
- ¥15 ads仿真结果在圆图上是怎么读数的
- ¥20 Cotex M3的调试和程序执行方式是什么样的?
- ¥20 java项目连接sqlserver时报ssl相关错误
- ¥15 一道python难题3