scanf放入c++程序中需要改动什么

如题所述

c++ 原来的 头文件 保持不变,后面加一句 #include <stdio.h>
就可使用 scanf(),而且仍然可以使用 cout ,甚至 一会儿 用 c, 一会儿 用 c++.
实质上 , c 是 c++ 的 一部分 (c++ 是在 c 的基础上 加了又加 制造出来的).
例如:
#include<iostream>
#include<fstream>
#include <string>
using namespace std;
#include <stdio.h>
。。。其它什么都不用改。。。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-06-20
c++中是允许使用c风格的代码的,无需改动
第2个回答  2015-06-20
#include <cstdio>
加上这句就可以
第3个回答  2015-06-20
#include<stdio.h>
第4个回答  2015-06-20
改成cin即可。
相似回答