qq_42364017
qq_42364017
采纳率50%
2018-12-20 22:10 阅读 1.4k

怎么把一个控制台程序写成mfc程序

之前从来没有接触过mfc,这次的作业老师说最好有界面..于是就想试着学习一下,但是却毫无头绪。
这是我C++的源代码:
#include
#include
#include
using namespace std;
typedef struct
{
int year,month,day;
}date;
int days(date t)
{
static const int a[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
int i;
int r = 0;
for (i = 0; i r += a[i];
if (t.month>2 && ((t.year % 400 == 0) || (t.year % 100 != 0 && t.year % 4 == 0))) r++;
r += t.day;
return r;
}
int weeks(date t, int *w)
{
int d1, d2, d3, r = 1;
date d31 = { 0,3,1 }, d831 = { 0,8,31 };
d1 = days(t);
d31.year = d831.year = t.year;
d2 = days(d31);
d3 = days(d831);
if (d1 > d3)
*w = d1 - d3 - 1;
else if (d1 < d2)
*w = 121 + d2;
else
{
*w = d1 - d2;
r = 2;
}
*w = *w / 7 + 1;
return r;
}

int main()
{
int w, p, d;
date t;
ofstream mycout("outfile.txt");
while (1)
{
cout<<"请输入年月日(例2018 5 4):"< cin>>t.year>>t.month>>t.day;
d = days(t);
p = weeks(t, &w);
cout << t.year << "年" << t.month << "月" << t.day << "日属于本年第" << d << "天," << "第" << p << "学期" << "第" << w << "周。" << endl;
mycout << t.year << "年" << t.month << "月" << t.day << "日属于本年第" << d << "天," << "第" << p << "学期" << "第" << w << "周。" << endl;
cout<<"请选择是否继续运行教学日历(Y/N):";
w=getchar();
if (w== 'n' || w == 'N')break;
}
mycout.close();
return 0;
}

我想将它变成图片说明
类似这样的mfc程序
应该怎么操作呢
求各位大神解惑..

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • zgbzsu2008 zgbzsu2008 2018-12-21 02:39

    找几个mfc入门的例子看下就会了。。很基础的

    点赞 评论 复制链接分享

相关推荐