Mister-小方


私信TA

用户名:1104986125

访问量:239187

签 名:

如此英俊为哪般

等  级
排  名 3
经  验 35742
参赛次数 1
文章发表 68
年  龄 19
在职情况 学生
学  校 大连交通大学
专  业 车辆工程

  自我简介:

TA的其他文章

解题思路以及注意事项:

  1. 本题主要了解scanf的用法,其格式为            scanf("%d或%c或%f(这里写入你想要输入的变量的格式)",&ch(这里写你想要把输入的值赋给的变量));

  2. 一定要注意输入格式不能错,整型用%d,字符型用%c,浮点型用%f。

  3. &一定不能掉了,掉了编译链接没问题,但运行的时候会崩溃。

实例代码:

#include"stdio.h"
int main()
{
    char ch1,ch2,ch3,ch4,ch5;
    scanf("%c",&ch1);
    scanf("%c",&ch2);
    scanf("%c",&ch3);
    scanf("%c",&ch4);
    scanf("%c",&ch5);
    printf("%c%c%c%c%c",ch1+4,ch2+4,ch3+4,ch4+4,ch5+4);
    return 0;
}

有什么不懂的可以在评论区评论

 

0.0分

210 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

#include<stdio.h>
int main()
{
    char c1='C',c2='h',c3='i',c4='n',c5='a';
    c1=c1+4;
    c2=c2+4;
    c3=c3+4;
    c4=c4+4;
    c5=c5+4;
    printf("%c%c%c%c%c",c1,c2,c3,c4,c5);
    return 0;
}
是哪儿有问题?
2019-10-17 10:59:47
为何输出后没看见字符,反被360安全卫士报为木马
2019-10-17 10:57:11
哈哈哈哈看看我没看答案时写的~
哈哈哈嗝~

#include "stdafx.h"

int main(void){
	char num[27] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\0'};
	char c1,c2,c3,c4,c5;
	int ns = 0;

	scanf("%c %c %c %c %c",&c1,&c2,&c3,&c4,&c5);
	while(ns < 26){
		switch(num[ns]){
			case 'c':
				c1=num[ns+4];
				//printf("%c\n",c1);
			break;
			case 'h':
				c2=num[ns+4];
				//printf("%c\n",c2);
			break;
			case 'i':
				c3=num[ns+4];
				//printf("%c\n",c3);
			break;
			case 'n':
				c4=num[ns+4];
				//printf("%c\n",c4);
			break;
			case 'a':
				c5=num[ns+4];
2019-10-11 20:47:02
#include<stdio.h>
#include<string.h>
int main()
{
      int i;
	char chi;
	for(i=1;i<=5;)
	{
		scanf("%c",&chi);
		printf("%c",chi+4);
		i++;
	}
	return 0;
}
2019-10-06 09:51:33
#include<stdio.h>
int main()
{
	char c[5];

	scanf("%c%c%c%c%c",&c[0],&c[1],&c[2],&c[3],&c[4]);
	for (int i = 0; i < 5; ++i)
	{
		printf("%c",c[i]+4);
	}

}
2019-09-29 18:43:27
char c1, c2, c3, c4, c5;
	scanf("%c%c%c%c%c%c", &c1, &c2, &c3, &c4, &c5);
	c1 = c1 + 4;
	c2 = c2 + 4;
	c3 = c3 + 4;
	c4 = c4 + 4;
	c5 = c5 + 4;
	printf("%c%c%c%c%c%c",c1,c2,c3,c4,c5);

	return 0;


这个为什么不对啊?
2019-09-24 23:53:34
#include<stdio.h>

int main()
{
char ch1, ch2, ch3, ch4, ch5;
scanf("%C%C%C%C%C%C",&ch1,&ch2,&ch3,&ch4,&ch5);
ch1 = ch1 + 4;
ch2 = ch2 + 4;
ch3 = ch3 + 4;
ch4 = ch4 + 4;
ch5 = ch5 + 4;
printf("%C%C%C%C%C",ch1,ch2,ch3,ch4,ch5);

return 0;
}
为什么编译没错误 可就是你运行不出来
2019-08-20 21:08:05
请问这个出现什么问题了?

#include <stdio.h>

int main() {
	char c1, c2, c3, c4, c5;
	scanf_s("%c%c%c%c%c", &c1, &c2, &c3, &c4, &c5);
	printf("%c%c%c%c%c%", c1+4, c2+4, c3+4, c4+4, c5+4);
}
2019-07-17 23:00:04