急求4道C语言题目的编程~~

1.请编写函数fun,它的功能是:求出1到100之内能被7或者11整除,但不能同时被7和11整除的所有整数,并指出有多少个。2、请编写函数fun,其功能是:将两个两位数的... 1.请编写函数fun,它的功能是:求出1到100之内能被7或者11整除,但不能同时被7和11整除的所有整数,并指出有多少个。

2、请编写函数fun,其功能是:将两个两位数的正整数a,b合并成一个整数放在c中。合并的方式是:将a数的十位和个位依次放在c数的千位和十位上,b数的十位和个位数依次放在c数的百位和个位上。

3、编写函数fun,其功能是:实现交换两个变量值的操作。例如:若变量a中的值原为8, b中的值为3; 程序运行后a中的值为3, b中的值为8 。

4、编写函数fun,其功能是:输入一串字符后,分别统计出大写字母和小写字母的个数,其他的字符放在一并统计。

请把编程过程发下,谢谢了!
今天晚上11点前回答很准确的送30分啊~拜托各位大虾了!
展开
 我来答
百度网友3d7e657ef
2009-06-18 · 超过28用户采纳过TA的回答
知道答主
回答量:89
采纳率:0%
帮助的人:0
展开全部
第一题:
#include <iostream.h>
int main()
{
int a=1;
int count=0;
for(a=1;a<101;a++)
{
if((a%7==0 || a%11==0) && !(a%7==0 && a%11==0))
{
count++;
}
}
printf("betwwen 1 and 100,there are %d",count);
printf(" number(s)\n");
system("pause");
}
第二题:
#include <iostream.h>
void fun()
{
int a;
int b;
int i,j,m,n;
int c;
printf("please input a number betwwen 10 and 100:");
scanf("%d",&a);
while(a<10 || a>101)
{
printf("input error!");
printf("please input a number betwwen 10 and 100:");
scanf("%d",&a);
}
printf("please input a number betwwen 10 and 100:");
scanf("%d",&b);
while(b<10 || b>101)
{
printf("input error!");
printf("please input a number betwwen 10 and 100:");
scanf("%d",&b);
}
i=a%10;
j=a/10;
m=b%10;
n=b/10;
c=j*1000+i*10+n*100+m;
printf("the new number is %d\n",c);
}
int main()
{
fun();
system("pause");
return 0;
}

第三题:
#include <iostream.h>
void fun(int * a,int * b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}

int main()
{
int a,b,* p,* q;
printf("please input a number:");
scanf("%d",&a);
p=&a;
printf("please input a number:");
scanf("%d",&b);
q=&b;
printf("before swap:%d,%d\n",a,b);
fun(p,q);
printf("after swap:%d,%d\n",a,b);
system("pause");
return 0;
}

第四题:
#include <iostream.h>
#include <string.h>
void fun()
{
char s[100];
int i=0;
int capital=0;
int letter=0;
int other=0;
printf("please input a string:");
scanf("%s",s);
while(strlen(s)>100)
{
printf("the length of string should less than 100!please input a string:");
scanf("%s",s);
}
for(i=0;s[i]!='\0';i++)
{
if((int)s[i]>64 && (int)s[i]<91)
{
capital++;
}
if((int)s[i]>96 && (int)s[i]<123)
{
letter++;
}
else
{
other++;
}
}
printf("capital letter(s):%d\n",capital);
printf("small letter(s):%d\n",letter);
printf("other letter(s):%d\n",other);
}

int main()
{
fun();
system("pause");
return 0;
}
lmx10086
2009-06-18 · TA获得超过340个赞
知道小有建树答主
回答量:232
采纳率:0%
帮助的人:233万
展开全部
30/4=7.5
这分少了点哈,你还不如十分一个,提四个问题,因为每采纳一个百度还会奖励20分...........
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式