轩辕春秋文化论坛 » 设计与修改 » 我用VC++做的第一个游戏


2004-12-26 18:38 陈珺
源码:
#include<iostream.h>
#include<windows.h>
#include<time.h>
int rnd(int num)
{
    int r;
    for(int i=0;i<99;i++)
    {
    r=rand()%num;
    }
    return r;
}
int main()
{
    int a,b;
    srand((unsigned)time(NULL));
    cout << "请输入你所猜的数字:";
    cin >> a;
    b=rnd(10);
    while(a!=
    {
    if (a>b)
    {
    cout<<"太大了";
    }
    if (a<b)
    {
    cout<<"太小了";
    }
    cin >> a;
    }
    cout<<"猜对了";
    cin >> a;
}

2004-12-27 13:34 阿尔法孝直
我的Win2000的DOS下全屏显示不正常,在窗口下完你的游戏中文显示又不正常~~~

页: [1]


Powered by Discuz! Archiver 5.0.0  © 2001-2006 Comsenz Inc.