#include <graphics.h>
#include <conio.h>
#include <time.h>
#include <stdio.h>
#include <windows.h>
#include <string>
using namespace std;
#pragma comment(lib,"Winmm.lib")
//全局变量
IMAGE a, b, c, d, e, f; //六个卡牌
IMAGE j; //背景
IMAGE g; //光芒
//int整形
int get = 0; //获取键盘消息
int A, B, C, D, E, F; //rand保存
void loaimage()
{
loadimage(&a, L"1.png", 170, 278);
………………
}
//rand函数
//放图片
void put()
{
putimage(0, 0, &j);
……
}
//启动
void start()
{
……函数均被调用………………
}
//展示结果
void show(int num)
{
srand(time(0));
if (num == 1)
{
A = rand() & 4 + 1;
putimage(0, 0, &j);
switch (A)
{
case 1:outtextxy……");
case 2:outtextxy……
case 3:outtextxy……
case 4:outtextxy……
}
}
else if (num == 2)
{
B = rand() & 4 + 1;
switch (B)
{
……
}
}
else if (num == 3)
{
C = rand() & 4 + 1;
switch (C)
{
……
}
}
else if (num == 4)
{
D = rand() & 4 + 1;
switch (D)
{
……
}
}
else if (num == 5)
{
E = rand() & 4 + 1;
switch (E)
{
…………
}
}
else if (num == 6)
{
F = rand() & 4 + 1;
switch (F)
{
…………
}
}
}
//主函数
int main()
{
initgraph(1152, 648);
………………………………
while (true)
{
start();
if (GetAsyncKeyState(1) && 0x8000)
{
show(1);
}
else if (GetAsyncKeyState(2) && 0x8000)
{
show(2);
}
…………
}
return 0;
}
运行代码编译通过,按键时无效不输出文字也不放图片,win10、win7、release、x86、vc2019
望大佬求助