![](/img/trans.png)
[英]How do I take full name of students(including space) as input from console and store it in an array in c++?
[英]How do I take input from the user of their full name, and then output their first name and last name seperately? (C++)
到目前为止,我只做了大纲,我只是不知道如何继续它,我很难过。
示例 output 应该是:
#include <iostream>
#include <string>
using namespace std;
int main() {
string fullName;
string firstName;
string lastName;
cout << "please input your full name, specifying only your last and first name" << endl;
cin >> fullName;
fullName = firstName + lastName;
cin
忽略空格/换行符,所以你可以使用这个:
cin >> firstname >> lastname;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.