帮我用c语言写一段心理测试问卷
时间: 2023-10-15 22:05:56 浏览: 48
好的,下面是一份简单的心理测试问卷,使用C语言实现:
```
#include <stdio.h>
int main() {
char name[50];
int age, score = 0;
char answer;
printf("欢迎来到心理测试问卷!\n");
printf("请输入您的姓名:");
scanf("%s", name);
printf("请输入您的年龄:");
scanf("%d", &age);
printf("\n1. 你觉得自己乐观吗?(Y/N) ");
scanf(" %c", &answer);
if (answer == 'Y' || answer == 'y') {
score += 5;
}
printf("2. 你是否经常感到孤独?(Y/N) ");
scanf(" %c", &answer);
if (answer == 'Y' || answer == 'y') {
score += 10;
}
printf("3. 你是否经常感到紧张或者焦虑?(Y/N) ");
scanf(" %c", &answer);
if (answer == 'Y' || answer == 'y') {
score += 10;
}
printf("4. 你是否经常感到疲劳或者无力?(Y/N) ");
scanf(" %c", &answer);
if (answer == 'Y' || answer == 'y') {
score += 5;
}
printf("5. 你是否经常感到失眠或者难以入睡?(Y/N) ");
scanf(" %c", &answer);
if (answer == 'Y' || answer == 'y') {
score += 10;
}
printf("\n测试结束,%s,您的得分为:%d分\n", name, score);
if (score >= 30) {
printf("您可能有一些心理问题,建议您及时寻求专业心理咨询。\n");
} else {
printf("您的心理状况良好,继续保持!\n");
}
return 0;
}
```
这份问卷共有5个问题,每个问题都是一个Y/N的选择题。根据答案不同,给出不同的分数。最后根据总分数,给出测试结果和建议。
相关推荐
![text/x-c](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)