请问。编程中cout和printf的区别

2025-03-07 08:15:46
推荐回答(2个)
回答1:

一是写法不对,另外要注意命名空间的写法
#include
using namespace std; //注意命名空间位置
int main()
{

printf("hello world \n");
return 0;
}
#include
using namespace std;
main()
{

cout<<"hello world \n"<或cout<<"hello world \n“;
return 0;
}

回答2:

#include
main()
{
using namespace std;
cout("hello world \n");
return 0;
}
写错了而已cout是这样弄得:
cout<<"hello world"<