大侠们帮忙做几个C语言编程题吧~~~考试要用的(请尽快,在线等)

作者&投稿:燕陆 (若有异议请与网页底部的电邮联系)
编程题 快 在线等~

#includemain(){ int i,n,max=0; for(i=0;imax) max=n; } printf("%d",max);}

不用中间变量变换A,B的值好简单哦~~~答案给你了你一定要代值进去算哈!得行的话要采用我的答案哦,不然的话打字就白打了.呵呵 ~~~(算了,我还是给你代个值好看些.)
a=1,b=2

a=a+b (现在a=3,b=2)
b=a-b (现在a=3,b=1)
a=a-b (好,最后就OK了! a=2,b=1)

简单吧!程序的话就不用说怎么写了吧!

不知道是帮了你还是害了你,你学什么的,多大了,这些是最基础的题,很简单的,自己多看看书吧,这些程序都试过,可以运行,自己好好看看
1.
#include <stdio.h>
main()
{
int x,y;
printf("please input x :");
scanf("%d",&x);
/*下面三句可以用这一句代替: y=(x<0)?(x-1):(x=0?0:1);*/
if(x<0) y=x-1;
else if(x==0) y=0;
else y=1;
printf("the value of y=%d",y);
getch();
}
2.
#include <stdio.h>
main()
{
int h,i,s;
s=560;
h=s/60;
i=s%60;
printf("%d minutes equals %d hours %dminutes",s,h,i);
getch();
}
3.
#include <stdio.h>
main()
{
int a,b,c,d,max,temp;
max=0;
temp=0;
printf("please input the value of a,b,c,d:\n");
scanf("%d%d%d%d",&a,&b,&c,&d);
/*以下六行可被这一行代替: max=(a>b?a:b)>(c>d?c:d)?(a>b?a:b):(c>d?:d);*/
if(a>=b)max=a;
else max=b;
if(c>=d)temp=c;
else temp=d;
if(max<temp)max=temp;
printf("the max of a,b,c,d is %d ",max);
getch();
}
4
#include <stdio.h>
main()
{
char c;
int character=0 ,number=0,space=0 ,others=0;
/*
输入
abcdefg1234 <><>
输出
character=7
number=4
space=3
others=5
*/
do
{
c=getchar();
if(c>='a'&&c<='z'||c>='A'&&c<='Z')character++;
else if(c>='0'&&c<='9')number++;
else if(c==' ')space++;
else others++;
}
while(c!='\n') ;
printf("character=%d\nnumber=%d\nspace=%d\nothers=%d\n",character,number,space,others);
getch();
}
5.
#include <stdio.h>
main()
{
printf(" * * * * * * * ** *\n");
printf(" * * * * * * * * * *\n");
printf(" * * * * * * * * * *\n");
printf(" * * * * * * * * * *\n");
getch();
}
6.
#include <stdio.h>
main()
{
int i=0;
int j=0;
printf(" ");
for(;i<5;i++)
{
for(j=5-i;j>0;j--)
printf(" ");
printf("@");
for(j=0;j<i;j++)
printf("@@");
printf("\n");
}
getch();
}
7.
#include <stdio.h>
float a(float n)
{
float an;
if(n<1)
return -1;
else if(n==1)
an=1;
else
an=a(n-1)+(2*n-1)/(n*n);
return an;
}
main()
{
float n;
printf("please input n:");
scanf("%f",&n);
printf("a(n)=%f",a(n));
getch();
}
8.
#include <stdio.h>
int a(int n)
{
int i,an=0;
for(i=1;i<=n;i++)
{
an+=i;
}
return an;
}
main()
{
int n;
printf("please input n:");
scanf("%d",&n);
printf("a(n)=%d",a(n));
getch();
}
9.
#include <stdio.h>
int a(int n)
{
int i,an=0;
for(i=1;i<=n;i++)
{
if(i%2==1)
an+=2*i-1;
else
an-=2*i-1;
}
return an;
}
main()
{
int n;
printf("please input n:");
scanf("%d",&n);
printf("a(n)=%d",a(n));
getch();
}
10.
#include <stdio.h>
main()
{
int a[3][4]={{1,2,3,4}, {9,8,7,6}, {-10,10,-5,2}};
int i,j,max,maxi,maxj;
max=0;
maxi=0;
maxj=0;
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
if(max<a[i][j])
{
max=a[i][j];
maxi=i;
maxj=j;
}
}
printf("maximum of the array is a[%d][%d]=%d",maxi,maxj,max);
getch();
}
11.
#include <stdio.h>
main()
{
int i,n,num=0,sum=0;
int a[100];
printf("please input the number of the

students n=");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf ("please input the NO.%d student's score",i+1);
scanf("%d",&a[i]);
if(a[i]>90)num++;
sum+=a[i];
}
printf("sum of the score is %d\nthe number of student whose score passed 90 is %d",sum,num);
getch();
}
12.
#include <stdio.h>
main()
{
int f,g,x;
printf("please input the value of x:") ;
scanf("%d",&x);
g=2*x+1;
f=(g+1)/2;
printf("G(x)=%d\n",g);
printf("F(G(x))=%d\n",f);
getch();
}

参考资料
http://hi.baidu.com/ttcc2009/blog/item/c2cc7195d20e2414d31b70af.html

楼上强大,我正说写一下的,好多分呐
那我不写了

答案已经发到邮箱了,记得给分哦

第一题你没有说明白。

做了几个了,我先睡觉了,明天再帮你做。

完成的我放在下面的这个连接中了,


求红外解码并通过数码管显示出来的C语言程序?大侠们,请帮帮忙
---*\/ void Ir_work(void)\/\/红外键值散转程序 { switch(IRcord[2])\/\/判断第三个数码值 { case 0x0c:DataPort=dofly_DuanMa[1];break;\/\/1 显示相应的按键值 case 0x18:DataPort=dofly_DuanMa[2];break;\/\/2

C语言中很基础的问题,求C语言大侠指点!!
只要是变量都能装数字 只是有大小而已 100不超过char的范围 所以是可以的。-0x1f的的编译器上是-31.

C语言考题,大侠帮忙
int f(char *p,char c){ int flag=0;while(*p!='\\0'){ if(*p==c)flag=1;p++;} if(flag)return 1;else return 0;} void main(){ char ch[50],c;int a;printf("输入字符串:");gets(ch);printf("输入要查找字符:");scanf("%c",&c);a=f(ch,c);printf("%d\\n",a);...

C语言 函数调用请大侠们 帮帮忙 急用!!
不是很明白你的意思。如果就是想让speed3()函数调用十次后跳出那你下面的speed3()函数不用看。在上面改一下就可以了。把这个:else if(N<=1) speed3();改成:else if(n<=1){ for(t=1;t<=10;t++)speed3()} 在最前面int 里面多定义个t 就可以了。还有else if(1<N<=2) speed2...

单片机C语言 键盘编程问题 做的 关于密码锁 数码管显示 希望解答 大侠...
给你个框架看看 define N 4 dfeine INPUT 12 define CHG 13 define CONFIRM 14 define idle 0 define inputpass 1 define chgpass 2 define waitconfirm 3 define end 4 unsigned char keyscan(){ unsigned char key,tempkey;\/\/get key \/\/delay()\/\/confirm key \/\/return key } void show_...

用c语言编写程序,提示用户输入两个字符串,并检验第一个字符串是否为第...
在C++和JAVA中这个是有专门函数来做的。C里面没有。好,我给你写一个!include <stdio.h> int isstr(const char *source,const char *dest){ int i=0,j,k;while(source[i]!='\\0'){ k=i;j=0;while(source[k]!='\\0'&&dest[j]!='\\0'&&source[k]==dest[j])k++,j++;if (...

...知道的大侠们帮帮忙 全部家产都压上了 谢谢了!!
\/\/时间函数举例4,一个猜数游戏,判断一个人反应快慢。include "time.h"include "stdlib.h"include "stdio.h"main(){char c;clock_t start,end;time_t a,b;double var;int i,guess;srand(time(NULL));printf("do you want to play it.('y' or 'n') \\n");loop:while((c=getchar(...

请各位大侠帮帮我哦~~~自动售货机C语言编程
同学 我们出这个题目给你们实习 你们怎么可以这样草草了事呢?? 做人要厚道……别人回答的 我会立刻记录答案 到时记为零分就不好了是吧?另外 请别人回答问题怎么可以没有悬赏呢??怎么大一个程序 好歹几百行吧?总评:猥琐!

C语言数据结构的问题,本人是初学者,请各位大侠们帮帮忙!
include<stdio.h> include<malloc.h> \/*从键盘输入5个学生的信息,学生的信息包括姓名和学号两个部分,产生顺序表,并输出用户输入的结点值。从键盘输入要插入学生的学号,姓名,将其插入在对应位置上,输出顺序表所有结点值,观察输出结果*\/ \/\/#define uchar unsigned char \/\/#define uint unsigned ...

一个关于创建C语言函数库的问题?
静态链接库(Static Libary)用VS2008做一个静态链接库先 打开VS2008,选择控制台应用程序,下一步里面选择lib 新建static_lib.h 和static_lib.cpp 两个文件,这两个文件的内容如下:static_lib.h:int add(int x,int y);int substract(int x , int y); static_lib.cpp:#include "static_...

太湖县15335247513: 急!!!哪位大侠帮忙做几道C语言的题
诸超太之: int factor(int n) { if (n==0) return 1; else return n*factor(n-1); }

太湖县15335247513: 简单的C语言编程题,请帮忙做一下 -
诸超太之: 1)#include<stdio.h> int main() { int n; scanf("%d",&n); if(n%2==1)n++;else n+=2;printf("%d\n",n); system("pause");return 0; }2) #include<stdio.h> int main() { int n,m; scanf("%d %d",&n,&m); if(n%m==0)printf("%d是%d的倍数\n",n,m);else printf("%d不是%d的倍数\n",n,m); system("pause");return 0; }

太湖县15335247513: 帮忙做下C语言题!
诸超太之: #include<stdio.h> void main() { int a,b,c,d; printf("请输入需要两个个数:"); scanf("%d%d",&a,&b); c=a/b; d=a%b; printf("两数的商为:"+c+" .两数的商的余数为:"+d+".\n"); } 楼主还有疑问没?额,不好意思,中文写错了,应该是请输入两个需要计算的数 printf语句可以写成printf("两数的商为:%d .两数的商的余数为:%d.\n",c,d); 我还是用英文写那个吧,避免楼主复制会出现错误,应该是 printf("两数的商为:%d 两数的商的余数为:%d \n",c,d);

太湖县15335247513: 帮忙做几道c语言的编程吧 -
诸超太之: 我考,中午看见了和这4个一样的题...1,下面程序段将输出 computer,请填空.i<Strlen(charc) if(i<7) continue;2,,strcmp(str[0],str[1])<0?str[0]:str[1] s3, 在以下程序,数组 a 中存放一个递增数列.输入一个整数 x,并将它插入到数组 a 中,使该数组仍为一个递增数列.请选择正确的答案.D (因为要插入另外一个x 所以必须要11) A(跳出循环A) D(向前遍历) D(插入x)

太湖县15335247513: 简单的C语言编程题,望大家帮忙 -
诸超太之: #include<stdio.h>#include<stdlib.h>#include<string.h> int main() { int i=0,t; char str[80],*a[10]; printf("Input string:"); do { scanf("%s",str); a[i]=(char *)malloc(sizeof(strlen(str)+1)); strcpy(a[i],str); i++; }while(getchar()!='\n'); for(t=i-1;t>=0;t--) { printf("%s ",a[t]); } putchar('\n'); return 0; }

太湖县15335247513: 求助:几道简单C语言程序小题 -
诸超太之: ❶在a=2,b=0,c;则执行c=b||a--;语句后,a和c的结果是(选C) A.0,1...

太湖县15335247513: 帮忙写下C语言的编程题吧 -
诸超太之: 1.#includeint main(){float n=4.3;printf("%f.2\n",n*n*n);//体积printf("%f.2\n",n*n*8);//表面积return 0;}2.#includeint main(){char c;getchar();putchar(c-32);putchar('\n');return 0;}#includeint main(){ int a,b,c,t,m;scanf("%d%d%d",&a,&b,&c);t=b;b=a;m=c;c=t;a=m;printf("%d %d %d\n",a,b,c);return 0;}

太湖县15335247513: 求大侠帮忙,一道C语言程序编程题目. -
诸超太之: 我有思路了:依次对n个点验证:方法如下,从第i个点到给定的点有一个射线,求这个射线(给定点之后,沿着第射线的方向)上有多少个和多边形的边相交(交线在边长内)的点,如果数目是0或偶数个,则该点不在多边形内部,如果是奇数个,就判断下一个(i+1)点的情况.如果都是奇数个就证明在多边形内.程序太麻烦了,三十分太少!再给你一个方法吧,这个方法对于突多边形很有效,比上面的简单.方法就是:用多边形每个边和要判断的定点组成三角形,看报顶角度数算出来,把所有的这样的顶角度数都算出来求和,如果等于360度,就在里面,不等于就不在.简单么?自己编吧,不过好像凹多边形时不成立.

太湖县15335247513: 哪位大侠帮我做一个C语言的题目:
诸超太之: #include <stdio.h> void main() { int Len(char ch[]); char ch[] = "Hello Wordl"; printf("Len : %d\n",Len(ch)); } int Len(char ch[]) { int i=0; while (ch[i]!='\0') { i++; } return i; }//只供参考作用...

太湖县15335247513: 大侠帮我做下这两个C语言题.谢谢啊!很急啊
诸超太之: 1、 #include <stdio.h> void fun(int n) { if(n) { printf("%d", n%10); fun(n/10); } } int main() { int n; scanf("%d", &n); fun(n); } 2、 #include <stdio.h> int main() { char a[123], c; int n = 0, i; gets(a); c = getchar(); for(i = 0; a[i]; ++i) if(a[i] == c) ++n; printf("%d", n); }

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网