我想在 C++ 中的消息框的不同行中显示多个字符串。 我希望它显示为:
Number of Words: 10
Number of Sentences: 5
Number of Digits: 2
Number of Upper Case Characters:5
我该怎么做? MessageBox( NULL, HERE,"CSE 3120 - 学期项目", MB_OK | MB_ICONEXCLAMATION);
而不是这里,所有这些字符串都应该去..我只是不知道如何显示它们,所有数字都存储在变量中。
有什么想法吗? 提前致谢,伙计们:)
最佳答案
试试这个...
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);
关于c++ - 在消息框 C++ 中发布或显示多个字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20297013/