Xcode编程为什么总在sleep时出现错误,出现conflicting types for“sleep”,以下为我的程序
#include<stdio.h>#include<stdlib.h>voidCongratulateStudent(char*student,char*course,i...
#include <stdio.h>
#include <stdlib.h>
void CongratulateStudent(char*student,char*course,int numDays)
{
printf("%s has done as much %s Programming as I could fit into %d days.\n",
student,course,numDays);
}
int main(int argc, const char * argv[])
{
CongratulateStudent("Mark", "cocoa", 5);
sleep(2);
CongratulateStudent("Bo", "Objective-C", 2);
sleep(2);
CongratulateStudent("Mike", "Python", 5);
sleep(2);
CongratulateStudent("Ted", "ios", 5);
return 0;
} 展开
#include <stdlib.h>
void CongratulateStudent(char*student,char*course,int numDays)
{
printf("%s has done as much %s Programming as I could fit into %d days.\n",
student,course,numDays);
}
int main(int argc, const char * argv[])
{
CongratulateStudent("Mark", "cocoa", 5);
sleep(2);
CongratulateStudent("Bo", "Objective-C", 2);
sleep(2);
CongratulateStudent("Mike", "Python", 5);
sleep(2);
CongratulateStudent("Ted", "ios", 5);
return 0;
} 展开
2个回答
展开全部
//已修改调试完毕。
#include <stdio.h>
#include <stdlib.h>
#include<windows.h>//需要引入头文件
void CongratulateStudent(char*student,char*course,int numDays)
{
printf("%s has done as much %s Programming as I could fit into %d days.\n",
student,course,numDays);
}
int main(int argc, const char * argv[])
{
CongratulateStudent("Mark", "cocoa", 5);
Sleep(2); //是 Sleep 不是 sleep
CongratulateStudent("Bo", "Objective-C", 2);
Sleep(2);
CongratulateStudent("Mike", "Python", 5);
Sleep(2);
CongratulateStudent("Ted", "ios", 5);
return 0;
}
追问
谢谢,但我是在mac上,用的是Xcode
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询