长青木
长青木
全部文章
题解
归档
标签
去牛客网
登录
/
注册
长青木的博客
全部文章
/ 题解
(共3篇)
题解 | #获取字符串长度#
#include #include <string.h> using namespace std; int main() { char str[100] = { 0 }; cin.getline(str, sizeof(str)); // write your code here.....
C
2022-04-02
4
521
题解 | #复制部分字符串#
#include #include <stdio.h> #include <string.h> using namespace std; int main() { char str[30] = { 0 }; // cin.getline(str, sizeof(s...
C++
2022-04-02
0
316
题解 | #获取字符串长度#
首先定义一个指针 并让它指向字符数组, 字符数组的数组名表示字符串首字符的地址 再定义一个计数器 让其为0 再用while循环 从头开始遍历字符串 遍历一个让计数器加1个 直到遇到 \0 为止! 最后打印出计数器的值! 次计数器的值就是字符串的长度! #include <iostream&g...
C
2022-04-01
15
1619