Mister-小方


私信TA

用户名:1104986125

访问量:239052

签 名:

如此英俊为哪般

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

  自我简介:

解题思路以及注意事项:

  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>
#include <string.h>
void main()
{
    char a[50];
    scanf("%s",a);
	for(int i = 0;i<strlen(a);i++){
		printf("%c",a[i]+4);
	}
	printf("\n");
}
2019-07-17 10:58:15
#include<stdio.h>
int main()
{
    char c1='C',c2='h',c3='i',c4='n',c5='a';
    
    printf("%c%c%c%c%c%\n",c1+4,c2+4,c3+4,c4+4,c5+4);  
    return 0;
}
为什么不能赋值以后输出呢,代码长度也没超过内存
2019-06-12 20:46:10
#include<stdio.h>
int main(){
 char c1='C';
    char c2='h';
    char c3='i';
    char c4='n';
    char c5='a';
    printf("%c,%c,%c,%c,%c,%c",c1+4,c2+4,c3+4,c4+4,c5+4);
    return 0;
}
为什么不对
2019-06-03 22:19:31
#include<stdio.h>
int main()
{
    char c1='C';
    char c2='h';
    char c3='i';
    char c4='n';
    char c5='a';
    scanf("%c%c%c%c%c",&c1,&c2,&c3,&c4,&c5); 
    printf("%c%c%c%c%c%\n",c1+4,c2+4,c3+4,c4+4,c5+4);  
    return 0;


不知道哪里错了?
2019-05-29 23:02:22
如果用%s怎么搞
2019-05-17 20:36:04
为什么是ch12345,为什么多一个h?
2019-04-21 21:00:51
这个是高手,能让人理解,有多简单就多简单
2019-04-13 14:17:38
#include <stdio.h>
#include <string.h>

int main()
{
    char array[100];
    int i;
    scanf("%s",array);

    for( i=0; i<strlen(array); i++){
        array[i] += 4;
        printf("%c",array[i]);
    }
    
}
2019-04-12 17:15:15