sprintf is just like printf, only rather than sending the output to stdout it copies the formatted output to the target string.
If you try running the programs that were given as examples, but replace the call to system() with a call to printf() or cout, you should be able to see how it works.
Code:
#include <iostream>
#include <cstring>
using namespace std;
int main(void)
{
char string[30];
char word1[] = "This";
char word2[] = "is";
char word3 = 'a';
char word4[] = "string";
int number = 1234;
// This is were I copy all of the individual
// strings, chars and numbers into the target
// string, "string".
sprintf(string, "%s %s %c %s %d!", word1, word2, word3, word4, number);
cout << string << endl;
return 0;
}