一、N-S流程图;
二、运行结果;
三、源代码;
# define _CRT_SECURE_NO_WARNINGS
# include <stdio.h>int main()
{//初始化变量值;int a, b, c, d;int t = 0;//提示用户;printf("请输入四个整数a b c d:");//获取用户输入的值;scanf("%d %d %d %d", &a, &b, &c, &d);//比较运算;if (a > b){//交换位置;t = a;a = b;b = t;}if (a > c){//交换位置;t = a;a = c;c = t;}if (a > d){//交换位置;t = a;a = d;d = t;}if (b > c){//交换位置;t = b;b = c;c = t;}if (b > d){//交换位置;t = b;b = d;d = t;}if (c > d){//交换位置;t = c;c = d;d = t;}//输出结果;printf("根据您输入的数据,我们从小到大排序得到结果为:%d<%d<%d<%d", a, b, c, d);return 0;
}