#pragma warning(disable:4996)
#include
#include
#include
using namespace std;
int strcompare(char *ch1, char *ch2)
{
for (int i = 0; i < 25; i++)
if (ch1[i] != ch2[i])
return 0;
return 1;
}
int main()
{
char *no = { "" };
while (1)
{
#ifndef F
for (int i = 0; i < 25; i++)
{
cin >> no[i];
}
#define F
#endif
time_t now = time(0);
char *dt = ctime(&now);
//cout << "本地日期和时间:" << dt <<endl;
//char *no = { "Tue Nov 22 18:29:30 2016\n" };
if (strcompare(dt, no) == 1)
{
for (int i = 0; i < 20; i++)
{
Sleep(1000);
cout << "\a";
}
}
}
system("pause");
return 0;
}
char *no = { "" };这样不对,还是野指针,要改为这样:char a;char *no;no = &a;这样就不会有问题了
看看指针的问题 多检查