1048: [编程入门]自定义函数之字符串拷贝 在本道题中,输入字符串的时候我没有使用gets直接接受是因为gets和scanf连用时会出现错误,为什么会出现问题呢?我们以本道题为例来解释这一问题:在代码中,首先我们用scanf接受一个数字6作为n的值,但是我们并不是只输入了一个数字6,还有一个回车。 题解列表 2023年03月08日 0 点赞 0 评论 486 浏览 评分:0.0
[编程入门]自定义函数之字符串拷贝(水题) 摘要:解题思路:注意事项:参考代码:#include <stdio.h>int main(){ int n,m,i; char s[100]; scanf("%d",&n); for(i=0;i<=n;i+…… 题解列表 2023年01月08日 0 点赞 0 评论 525 浏览 评分:9.9
自定义函数之字符串拷贝(C语言) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<assert.h>char* my_strcpy( char* dest, const char* src,int m…… 题解列表 2023年01月05日 0 点赞 0 评论 473 浏览 评分:0.0
getchar用法。。。 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n,i,m; char str[100]; scanf("%d",&n); getchar(); get…… 题解列表 2022年12月03日 0 点赞 0 评论 518 浏览 评分:0.0
C语言 自定义函数之字符串拷贝& 摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<stdlib.h>#define Long 2int main(){ char* c[Long]; c…… 题解列表 2022年11月30日 0 点赞 0 评论 639 浏览 评分:0.0
一种超简单的方法 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int m,n,i; char str[100]; scanf("%d",&n); ge…… 题解列表 2022年11月27日 0 点赞 0 评论 468 浏览 评分:0.0
指针法巧解自定义函数之字符串拷贝 解题思路:1.先定义正常的n,m的值;2.定义一个变量i;3.定义一个指针指向a数组的首地址加上m-1,也就是意味着p指针指向了a[m-1];4.输出由指针p指向的字符串即可。注意事项:1.一定要注意变量初始化i的值;2.输出的时候注意要用%s, 题解列表 2022年11月13日 0 点赞 0 评论 545 浏览 评分:9.9
字符串拷贝简易版 摘要:解题思路:输入一串字符串,然后直接从输入的m个字符中从第n个开始截断输出注意事项:注意数组是从0开始计数,所以第一个字符对应的数组下标为0参考代码:#include <stdio.h>int main…… 题解列表 2022年11月05日 0 点赞 0 评论 546 浏览 评分:0.0
初学者思维解法 摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<string.h>int main(){ int a[1000]; int i,m,n,j; scanf("%d\n"…… 题解列表 2022年10月19日 0 点赞 0 评论 530 浏览 评分:0.0
自定义函数之字符串拷贝 #include#include#include#includeusingnamespacestd;voidfun(){chara[100],b[100];intn,m,i;cin>>n;for(i=0;i>a[i];}cin>>m;for(i=m-1;i 题解列表 2022年10月12日 0 点赞 0 评论 523 浏览 评分:0.0 « 12345678...1516 »