I don't understand - did you intentionally write this code to be bad, and you want people to make it less bad?
I don't understand - did you intentionally write this code to be bad, and you want people to make it less bad? |
This?
Same result in 10 lines without the pointless function.
1 2 3 4 5 6 7 8 9 10
|
#include <iostream>
#include <string>
using namespace std;
int main()
{
string Parts[] = { "this ", "is a ", "sentence! " };
for (int i = 0; i < 3; i++)
cout << Parts[i];
return 0;
}
|
Last edited on
Here is an improvement
1 2 3 4 5
|
#include<iostream>
int main(){
std::cout << "this is a sentence!";
return 0;
}
|
Last edited on
char *str[]= {"this", "is a ", "sentence! "};
how can i know the size of str[2] ??