我尝试做的是将问题1以不同的顺序随机化到问题20,当它是随机的时候我也可以在问题中输入我的答案.每当我尝试使用随机语句时,它总是会出现错误或意图错误.代码现在做的是按顺序打印问题.我所要做的就是将if和elif语句一起随机化
{} PY
name = raw_input("Hello what is your name? ")
print "Hi " + name
ready = raw_input("Are you ready to do the test?(Please enter YES/NO)")
while ready.lower() != "yes":
ready = raw_input("Are you ready to do the test?(Please enter YES/NO)")
if ready.lower() == "yes":
print "Excelent! The test will start in any second. "
if ready.lower() == "no":
print "Okay, tell me when you're ready. "
elif ready.lower() != "yes" and "no":
print "It okay if your're not …Run Code Online (Sandbox Code Playgroud) 我试图清空struct数组中的所有数据.
但事实证明是分段错误.有人可以帮帮我吗.
结构
struct entry
{
char user;
char name[9];
char extension[4];
short blockcount;
short block[8];
};
struct entry directory[128];
Run Code Online (Sandbox Code Playgroud)
主要()
for (int i = 0; i < 128; ++i)
{
memset(&directory[i], 0, sizeof(directory));
}
Run Code Online (Sandbox Code Playgroud)