当前位置:三九宝宝网 → 宝宝教育 → 教学论文 → 正文

C语言题目输入十个数倒置后输出我写了一个程序可以运行但是输不

更新:12-28 整理:39baobao.com
字体:

[四个数字排序的C语言程序]main() {int a,b,c,d,e; scanf("%d,%d,%d,%d",&a,&b,&c,&d); if(a<b) {e=a;a=b;a=e;} if(b<c) {e=b;b=c;b=e;} if(a<b){e=a;a=b;a=e;} if(c<d) {e=c;c=d;d=e;} if(b<c) {e=b;b...+阅读

先说楼主你那里错了:

for(i=0;i

#include

#define N 10

int main()

{

int a[N],i,t;

for(i=0;iscanf("%d",a+i);

for(i=0;i{

t=a[i];

a[i]=a[N-1-i];

a[N-1-i]=t;

}

for(i=0;iprintf("%d ",a[i]);

putchar('\n');

return 0;

}

满意请采纳,谢谢了

本文地址:https://www.39baobao.com/show/29_16394.html

以上内容来自互联网,请自行判断内容的正确性。若本站收录的信息无意侵犯了贵司版权,请联系我们,我们会及时处理和回复,谢谢.

以下为关联文档:

在C语言中要求输入4个数把4个数按从小到大排列起来请问原程序#include <stdio.h> int main() { int a[100],n,i,j,temp; printf("Input the numbers of data:"); scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n;i++) for(...

C语言编个排列四个数大小的程序例如输入12 23 344 19输出12 19结构混乱,语句错误,如if(a>b>c>d)就是错误的用法。 #include "stdio.h" #include "conio.h" main() { int a,b,c,d,t; sacnf("%d%d%d%d",&a,&b,&c,&d); if(a<b){t=a;a=b;b=t;} if(a<...

用C语言写一个能够实现四个数排序的程序#include stdio.h void main{ int i,j; int temp; int arr[] = {8,7,9,12}; for(i=0;i<arr.length;i++){ for(j=1;j<arr.length;j++){ if(arr[i]>arr[j]){ temp = arr[i]; a...

求C语言用冒泡法排序含n个数的数组a的程序#include<stdio.h> #include<vector> using namespace std; void fun(int *p,int n) //冒泡升序子函数 { for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) { if(*(p+i)>*(p+j)...

C语言输入十个数将其倒序排列使用函数嵌套的方法#include <stdio.h> #define N 5 void input(int [ ], int); void output(int [ ], int); void sort(int [ ], int); int minpos(int [ ], int, int); void swap(int [ ], i...

c语言创建一个储存10个数字的链表并倒序输出#include #include struct node { int a; node *next; }; void output(node *p) { if (p != NULL) { output(p->next); printf ("%d ", p->a); } } int main() { int a, n; no...

C语言创建一个存储10个数字的链表并倒序输出我这里有个热乎的C++用类实现的,功能很齐全,在VS2010很好运行,C版本的目前没有,笔记本上貌似,你先看行不行,直接把代码上去就可以了。请采纳。#include using namespace std; type...

输入任意十个数按照倒叙输出的c语言程序#include<stdio.h> void descList(int a[], int n){ int i, j, temp; for(i = 0; i < n;i ++){ for(j = 0; j < i; j++) { if(a[i] > a[j]){ temp = a[i]; a[i] = a[j]; a[j...

从键盘输入10个数存入数组把数组中的元素交换成逆序然后输出# include <stdio.h> int main (void) { printf("请输入数字,数字中间以空格隔开。\n"); int a[10]; char ch; int j = 0; for (int k = 0 ; k < 10 ; k++) { scanf("%d%c" , &a[k]...