好的,这是一个简单的 C 语言聊天程序示例:
#include <stdio.h>
#include <string.h>
int main(void) {
char input[100]; // 定义输入字符数组
char response[100]; // 定义回复字符数组
while (1) {
printf("你:"); // 提示用户输入
scanf("%s", input); // 读取用户输入
if (strcmp(input, "再见") == 0) { // 如果用户输入"再见",则退出循环
break