This commit is contained in:
2025-11-30 01:51:19 +03:00
commit 37237f67f8
12 changed files with 191 additions and 0 deletions

19
stringConcatenation.cpp Normal file
View File

@@ -0,0 +1,19 @@
#include <iostream>
#include <string>
using namespace std;
// return a string that contains n As
// In Java this code takes forever
string makeLongString( int n )
{
string result = "";
for( int i = 0; i < n; i++ )
result += "A";
return result;
}
int main( )
{
string manyAs = makeLongString( 250000 );
cout << "Short string is " << makeLongString( 20 ) << endl;
cout << "Length is " << manyAs.length( ) << endl;
return 0;
}