The original code is valid C++. If anything, to write it exactly as it is in C++ you could do this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
int main ()
char str="Test String.\n";
However, C++ programmers should prefer the solution I posted above, due to being smaller and more intuitive as to its function. You should probably get used to learning the STL and the huge number of useful function that it provides. Only real way to fully learn it, though, is to spend time looking through the references that can be found, for example on this website.