• 各位大佬,Dev-C++环境下怎么使用MessageBox输出变量呢?
  • 其它

本人曾用cstring里的strcat函数实现,希望有更优方案。
附上代码(无关部分已隐藏,不影响):

#include <iostream>
#include <cstdio>
#include <windows.h>
using namespace std;
int main() {
   cout << "输入一个不超过100的数:" << endl;
   int n;
   cin >> n;
   int m = n;
   ……
   char c1[1000];
   for (int i = 0; m; i++) {
       for (int i = 0; m; i++) {
       c1[i] = m % 10 + '0';
       m /= 10;
   }
   }
   char c[100] = "……";
   strcat(c, c1);
   strcat(c, "……");
   MessageBox(NULL, c, "提示", MB_ICONINFORMATION|MB_OK);
   return 0;
}


  • 西西    2020-03-23 10:41:10
  • 阅读 731    收藏 0    回答 1
  • 邀请
  • 收藏
  • 分享
发送
登录 后发表评论
  • 51testing软件测试圈微信