日本电影68天资源:c++编程的时候碰到一个问题,,实在是不会啊,那位大虾救救我吧!!!~~~

来源:百度文库 编辑:神马品牌网 时间:2024/04/20 16:20:24
在编程的时候出现了这个错误
这是我的源程序。#include "iostream.h"
#include "iostream.h"
#include "math.h"
#include "stdio.h"
void main()
{
float x,x0,x1,y0,y1,y;
printf("\n输入二个已知的函数值");
cin<<x0<<x1<<y0<<y1;
printf("\n输入要进行插植的数");
cin<<x;
y=y0*(x-x1)/(x0-x1)+y1*(x-x0)/(x1-x0);
cout>>y;
}
下面是错误的说明。
D:\Program Files\Microsoft Visual Studio\MyProjects\ttt\sdgds.cpp(10) : error C2676: binary '<<' : 'class istream_withassign' does not define this operator or a conversion to a type acceptable to the predefined operator
不行啊,,还是不能解决啊,!!!~~~
错误还是没有消失。
错误还是存在,D:\Program Files\Microsoft Visual Studio\MyProjects\ttt\sdgds.cpp(12) : error C2676: binary '<<' : 'class std::basic_istream<char,struct std::char_traits<char> >' does not define this operator or a conversion to a type acceptable to the predefined o

1.改为
#include <iostream.h>
#include <math.h>
#include <stdio.h>

2.在

#include "iostream.h"
#include "math.h"
#include "stdio.h"
后面添加一句:
using namespace std;

楼上不对,改为:
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
才对,注意哪些有h,哪些没有

在VC.net中运行C程序是要注意命名空间
头文件引用改为:
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

晕,
#include<iostream> using namespace std居然和#include<stdio.h>混用,后面的没有必要加上