/***************************************** * * 场景:人机对话 * 人和机器轮流说一句话,问候、询问,。。。 * 要说的话事前组织好 * * 人通过嘴说话,转换成文字通过键盘传递给机器, * 机器经由键盘通过耳朵接收到人说话的文字, * 并保存到机器的大脑记忆中,然后作思考。。。 * 机器将要说的话以文字形式通过其嘴说到屏幕上, * (也可以转换成语音,通过其嘴说到microphone) * 人通过眼睛看到屏幕上的文字,理解其含义。。。 * (或通过耳朵听到声音) * 现阶段 * 人到机器的信息传递通道:键盘——机器的耳朵:scanf * 机器到人的信息传递通道:屏幕——机器的嘴:printf * * 如何实现以下对话? * 小明:“你好,机器人!” * 计算机:“哦哦,你叫什么名字?” * 小明:“小明”。 * 计算机:“你好,小明!” * * * ****************************************/ #include <stdio.h> int main() { char greating[20]; char name[20]; scanf("%s", greating); printf("你叫什么名字?\n"); scanf("%s", name); printf("你好,%s\n", name); return 0; }
5 comments
/*
Desc: Hello, China!
Auth: Liutong Xu
*/
#include <stdio.h>
int main(void)
{
printf("Hello, China!\n");
return 0;
}
/* Desc: Long Live Chairman Mao! Auth: Liutong Xu */ #include <stdio.h> int main(void) { printf("毛主席万岁!\n"); return 0; }
stdout
毛主席万岁!
Page 5 of 5
Latest Commented
Problem Solving
- 学生信息管理系统
- Finite-state machine
- 索引数组
- 二维数组排序
- Get a valid Integer
- SubString Test
- String Reverse
- String Inserting and Deleting
- String Processing
- An Application of Two-Dimensional Array
- Stable Sort
- swap 和 & in scanf
- Right Shift
- Left Shift
- Mergesort
- Tower of Hanoi
- Recursive programs
- Sorting Algorithms
- Binary Search
- 计算机解题?人解题?
- World Population in 2015
- Flying Hello World!
- \(\cos x\)
- The Taylor series
- 交通车辆观测统计
- 问题的递归函数描述
- 程序设计
- Problem, Sub-problem, and Partial Solutions
- Integer Number Manipulation
- Prime Number
- How to wirte a Boolean expression?
- Summation from \(a_1\) up to ...
- Summation from \(a_1\) through \(a_n\)
- GCD of Two Integers
- Linear Search
- 今有物不知其数,三三数之剩二,五五数之剩 三,七七数之剩二,问物几何?
- 有条件转移
- Problem Solving
- \(A+B\)
- Solving a quadratic equation
- 人机对话
- Hello, China!
- Lesson One - Long Live Chairman Mao!