作业帮 > 综合 > 作业

1.Implement a C++ program which reads any integer from a use

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/14 04:01:31
1.Implement a C++ program which reads any integer from a user until he or she enters ‘end’.This program must show all of the numbers which are read from a keyboard after ‘end’ is read.
2.Make a C++ program which concatenates two strings.Those strings are read from a user.This program should read which string goes first,as well.The concatenation process should be done not in the main function,but in another function you declare.You must not use strcat( ).
1.Implement a C++ program which reads any integer from a user until he or she enters ‘end’.This program must show all of the numbers which are read from a keyboard after ‘end’ is read.
#include
#include
#include
using namespace std;
bool is_number(string s)
{
for (size_t i = 0; i < s.size(); i++)
{
if (s[i] < '0' || s[i] > '9')
return false;
}
return true;
}
int main()
{
string s;
vector v;
while (cin >> s)
{
if (s == "end")
{
for (size_t i = 0; i < v.size(); i++)
{
cout a >> b;
c = concatenate(a,b);
cout