‘壹’ 求编一个C语言程序 实现的效果是,将26个字母头尾对换,成为一个加密运算那种
#include <stdio.h>
int main(int argc, char *argv[])
{
char s[30];
gets(s);
for(int i=0;s[i];i++)
s[i]=122-(s[i]-97);
puts(s);
return 0;
}
/*要完成头尾互换很简单,只要找出当前字母和a之间的距离x,再找出距离z为x的另一个字母,这个字母就是要找的。a的ascii值为97,z的ascii值为122,所以用上面的减法就可以很容易完成。我这里只写了小写字母的算法,大写的或者大小写混合的你自己写写看吧*/
‘贰’ C语言1. 编写函数实现如下输出效果: *****************************************
void show()
{
printf("*****************************************\n");
printf("***********This is a Cprogram**************\n");
printf("*****************************************\n");
}
在main()中 show()就可以了
‘叁’ C语言,语句的执行效果
因为a>b按题条件不成立,所以A,B,D均可排除,因为最后IF判断完了以后,是不会执行后面的句子的,那么就是C了,按照相关知识点,运行完后,可以得出,a=2,b=3,c=3
‘肆’ 怎么用C语言绘制3D图形,实现类似于UE4这样的效果
我先给个例子,#include <graphics.h>
#include<stdlib.h>
#include<stdio.h>
#include "conio.h"
#include"math.h"
void main()
{
int gdriver=DETECT,gmode; /*图形模式设定*/
char f;
int m,n,x,y,t;
int color;
x=320;y=240;
m=0;n=0;
initgraph(&gdriver,&gmode,"c: \\tc");
printf("qweadzxc stand for eight direction,p to exit,and the number stand for color when paint\n");
printf("input anykey to start\n");
getch();
printf("PLEASE INPUT THE COLOR\n");
scanf("%d",&color);
loop:
while(!kbhit())
{
putpixel(x,y,color);
x=x+m;y=y+n;
for(t=0;t<=50;t++)
delay(100);
}
f=getch();
if(f=='w'||f=='W')
{
m=0;n=-1;
goto loop;
}
if(f=='x'||f=='X')
{
m=0;n=1;
goto loop;
}
if(f=='a'||f=='A')
{
m=-1;n=0;
goto loop;
}
if(f=='d'||f=='D')
{
m=1;n=0;
goto loop;
}
if(f=='q'||f=='Q')
{
m=-1;n=-1;
goto loop;
}
if(f=='e'||f=='E')
{
m=1;n=-1;
goto loop;
}
if(f=='z'||f=='Z')
{
m=-1;n=1;
goto loop;
}
if(f=='c'||f=='C')
{
m=1;n=1;
goto loop;
}
if(f==' ')
{
m=0;n=0;
getch();
goto loop;
}
if(f=='p'||f=='P')
goto end;
if(f=='s'||f=='S')
{
printf("please input the color you want to set\n");
scanf("%d",&color);
goto loop;
}
else
{
printf("ERROR!\n");
goto loop;
}
end:
getch();
closegraph(); /*退出图形模式*/
}
‘伍’ 如何用C语言编写下面效果
#include <stdio.h>
int main()
{
int i, j;
for(i = 2; i <= 10; i += 2) {
for(j = 0; j < i; ++j) {
printf("*");
}
printf("\n");
}
return 1;
}
‘陆’ 这个程序要怎么改才能实现预期效果(C语言)
首先这个题目就有问题,两个同名函数,就是函数复用了,C语言没有复用,这事面向对象的特性,C语言本身根本就做不到
‘柒’ C语言 怎么修改下列语句实现如下运行效果: Input an integer:650 The result is:056 万分感谢好心人
加两句就行了:
#include<stdio.h>
void main()
{
int x;
printf("Input an integer:") ;
scanf("%d",&x);
printf("The result is:");//加的第一句
while (x)
{
printf("%d", x%10);
x /= 10;
}
printf("\n");//加第二句,可以不加,
getch();
}
‘捌’ 一句C语言,这句话执行的效果是啥
#define BUILD_UINT16(loByte, hiByte) \
((uint16)(((loByte) & 0x00FF) + (((hiByte) & 0x00FF) << 8)))
这是一个宏定义,
作用是: 把两个8字节的数据,合并为一个16字节的数据。
比如:数据L=0x01数据H=0x80
执行 返回结果 = BUILD_UINT16( 数据L , 数据H );后
返回结果 = 0x8001
‘玖’ C语言 输入3,4 运行效果为 3+4=7 的语句怎么写, 跪谢了!!
#include<stdio.h>
int main()
{
int a,b;
printf("请输入两个整数,空格间隔,回车结束:\n");
scanf("%d %d",&a,&b);
printf("%d+%d=%d\n",a,b,a + b);
return 0;
}