Question

I want to display multiple strings in different lines in a messagebox in c++. I want it to show as:

Number of Words: 10
Number of Sentences: 5
Number of Digits: 2
Number of Upper Case Characters:5

How Do i do it? MessageBox( NULL, HERE,"CSE 3120 - Term Project", MB_OK | MB_ICONEXCLAMATION);

instead of here, all these string should go.. I just dont know how to show them, and all the numbers are stored in variables.

any idea? Thanks in advance, guys :)

Was it helpful?

Solution

Try this...

Number of Words: 10
Number of Sentences: 5
Number of Digits: 2
Number of Upper Case Characters:5    

char text[128];
sprintf(text, "Number of Words: %d", noOfWords);
sprintf(text, "Number of Sentences: %d", noOfSentences);
sprintf(text, "Number of Digits: %d", noOfDigits);
sprintf(text, "Number of Upper Case: %d", noOfUCase);
MessageBox(NULL, text, "", MB_OK);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top