Write a C++ program to create a new string using the first and last n characters from a given string of length at least n
- برمجة سي بلس بلس
- برمجة
- 2021-05-11
- MarwaMohammed
الأجوبة
#include
using namespace std;
string test(string s1, int n)
{
return s1.substr(0, n) + s1.substr(s1.length() - n);
}
int main()
{
cout << test("Hello", 1) << endl;
cout << test("Python", 2) << endl;
cout << test("on", 1) << endl;
cout << test("o", 1) << endl;
return 0;
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
