#include "stdafx.h"
#include <windows.h>
#include<iostream.h>

int _tmain(int argc, _TCHAR* argv[])
{
	SYSTEM_INFO si;
	GetSystemInfo(&si);

	printf("The page size for this system is %u bytes./n", si.dwPageSize);
	int a;
	cin >> a  ;
	return 0;
}

报错未定义标识符 cin

现在修改如下:

#include "stdafx.h"
#include <windows.h>
#include <iostream>  
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	SYSTEM_INFO si;
	GetSystemInfo(&si);
	printf("The page size for this system is %u bytes./n", si.dwPageSize);
	int a;
	cin >> a  ;
	return 0;
}

 using namespace std; 的问题
1:cin cout 在 std namespace 标准命名空间里:
2:将#include <iostream.h>非标准输入输出流修改为#include <iostream>的标准输入输出流

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐