--EDITED QUESTION--
Hi there
I'm new to this forum and c++. I'm working through a c++ book that uses purely iostream examples, and I've been told to only use stdio.h and I can't seem to translate this example from an iostream format to stdio.h. I know the basics of stdio.h but I can't workout how to manage objects. Thank you for any help you can give me.
However I have no idea how to find the string's size through the .size() function, I don't want to use sizeof. I also need to printf the character at position 0, find the phrase 'eggplant' and erase parts of 'phrase'. Basically I need this translated to stdio.h format.
cout << "The phrase has " << phrase.size() << " characters in it.\n\n";
cout << "The character at position 0 is: " << phrase[0] << "\n\n";
cout << "Changing the character at position 0.\n";
phrase[0] = ’L’;
cout << "The phrase is now: " << phrase << "\n\n";
for (unsignedint i = 0; i < phrase.size(); ++i)
{
cout << "Character at position " << i << " is: " << phrase[i] << endl;
}
cout << "\nThe sequence ’Over’ begins at location ";
cout << phrase.find("Over") << endl;
if (phrase.find("eggplant") == string::npos)
{
cout << "’eggplant’ is not in the phrase.\n\n";
}
phrase.erase(4, 5);
cout << "The phrase is now: " << phrase << endl;
phrase.erase(4);
cout << "The phrase is now: " << phrase << endl;
phrase.erase();
cout << "The phrase is now: " << phrase << endl;
if (phrase.empty())
{
cout << "\nThe phrase is no more.\n";
}
return 0;
}