![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串的输入
很酷V587
这个作者很懒,什么都没留下…
展开
-
C++ 中的 String 类
#include <iostream>#include <string> using namespace std; int main (){ string str1 = "runoob"; string str2 = "google"; string str3; int len ; // 复制 str1 到 str3 str3 = str1; cout << "str3 : " << str3 &l.转载 2021-12-26 16:43:25 · 49 阅读 · 0 评论 -
字符串的输入
getchar()获取一个字符gets获取一行字符串ch=cin.get(); //或者cin.get(ch);只能获取一个字符cin.get(a,20); //类似getline,可以输入多个单词,中间空格隔开。cin.getline() 获取一行字符串getline(cin,s)//可以输入多个单词。{char a[20];cin>>a;}//无空格...原创 2021-12-26 16:53:58 · 209 阅读 · 0 评论