Форум программистов, компьютерный форум CyberForum.ru

В чём ошибка???((( - C++

Восстановить пароль Регистрация
 
Pavel1133
3 / 3 / 0
Регистрация: 12.10.2009
Сообщений: 81
27.10.2009, 13:21     В чём ошибка???((( #1
Програма для нахождения площади интеграла

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include <math.h>
using namespace std;
void main(){
  double f(double);
  double integral(double;double;int);
  double A,B;
  int k=1;
  double Eps=0.001, Intnew=integral(A,B,k),Intold=0.00;
  cin>>A>>B<<endl;
  while(fabs(Intold-Intnew)>Eps){
    Intold=Intnew;
    k=k*2;
    Intnew=integral(A,B,k);
  }
  cout<<Intnew<<" Is square of your integral"<<endl;
  system("pause");
}
double f(double x){
  return(x*x);
}
double integral(double A;double B;int k) {
  double sum=(f(A)+f(B))/2;
  double step=(B-A)/k;
  double x =B+step;
  for( ;x<B;x+=step)
    sum+=f(x);
    sum*=step;
    return(sum);
}

Компилятор выдает
1>------ Build started: Project: integral(trapeciya), Configuration: Debug Win32 ------
1>Compiling...
1>integral.cpp
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(6) : error C2143: syntax error : missing ')' before ';'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(6) : warning C4091: '' : ignored on left of 'double' when no variable is declared
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(6) : error C2059: syntax error : ')'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(6) : warning C4091: '' : ignored on left of 'int' when no variable is declared
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(9) : error C2660: 'integral' : function does not take 3 arguments
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::basic_istream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(10) : error C2676: binary '<<' : 'std::basic_istream<_Elem,_Traits>' does not define this operator or a conversion to a type acceptable to the predefined operator
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(14) : error C2660: 'integral' : function does not take 3 arguments
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(22) : error C2143: syntax error : missing ')' before ';'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(22) : error C2059: syntax error : ')'
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(22) : error C2470: 'k' : looks like a function definition, but there is no parameter list; skipping apparent body
1>Build log was saved at "file://\\fpmi-servstud\kurs1\astrauh\integral(trapeciya)\integral(trapeciya)\Debug\BuildLog.htm"
1>integral(trapeciya) - 48 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



помогите разобраться плз
Similar
Эксперт
41792 / 34177 / 6122
Регистрация: 12.04.2006
Сообщений: 57,940
27.10.2009, 13:21     В чём ошибка???(((
Посмотрите здесь:

В чём ошибка? C++
в чём ошибка C++
в чём ошибка 3 C++
в чём ошибка C++
В чём ошибка? C++
C++ в чём ошибка?
C++ в чём ошибка C++
C++ в чём ошибка?
в чём ошибка? C++
C++ В чём ошибка?
C++ В чём ошибка?

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
После регистрации реклама в сообщениях будет скрыта и будут доступны все возможности форума.
TanT
эволюционирую потихоньку
 Аватар для TanT
464 / 462 / 43
Регистрация: 30.06.2009
Сообщений: 1,399
27.10.2009, 13:27     В чём ошибка???((( #2
сравни
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
#include <math.h>
using namespace std;
 
void main(){
    double f(double);
    double integral(double,double,int); //объявление функции с , а не ;
    double A,B;
    int k=1;
    double Eps=0.001, Intnew,Intold=0.00;
    
    cin>>A>>B;  // endl не требовался
    Intnew=integral(A,B,k);   // вызов функции с неинициализир перемнными (был)
    while(fabs(Intold-Intnew)>Eps){
        Intold=Intnew;
        k=k*2;
        Intnew=integral(A,B,k);
    }
    cout<<Intnew<<" Is square of your integral"<<endl;
    system("pause");
}
double f(double x){
    return(x*x);
}
double integral(double A,double B,int k) {
    double sum=(f(A)+f(B))/2;
    double step=(B-A)/k;
    double x =B+step;
    for( ;x<B;x+=step)
        sum+=f(x);
    sum*=step;
    return(sum);
}
Pavel1133
3 / 3 / 0
Регистрация: 12.10.2009
Сообщений: 81
27.10.2009, 13:33  [ТС]     В чём ошибка???((( #3
щас выдаёт

1>------ Build started: Project: integral(trapeciya), Configuration: Debug Win32 ------
1>Compiling...
1>integral.cpp
1>z:\astrauh\integral(trapeciya)\integral(trapeciya)\integral.cpp(2) : fatal error C1083: Cannot open include file: 'math': No such file or directory
1>integral 2.cpp
1>Generating Code...
1>Build log was saved at "file://\\fpmi-servstud\kurs1\astrauh\integral(trapeciya)\integral(trapeciya)\Debug\BuildLog.htm"
1>integral(trapeciya) - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
kazak
 Аватар для kazak
3029 / 2350 / 155
Регистрация: 11.03.2009
Сообщений: 5,401
27.10.2009, 13:34     В чём ошибка???((( #4
Строки 6
C++
1
double integral(double;double;int);
и 22
C++
1
double integral(double A;double B;int k)
переменные должны разделяться запятыми.
Строка 10
C++
1
cin>>A>>B<<endl;
убрать <<endl на фиг.
Pavel1133
3 / 3 / 0
Регистрация: 12.10.2009
Сообщений: 81
27.10.2009, 13:35  [ТС]     В чём ошибка???((( #5
а не спс всё работаёт )) я твой должник)
TanT
эволюционирую потихоньку
 Аватар для TanT
464 / 462 / 43
Регистрация: 30.06.2009
Сообщений: 1,399
27.10.2009, 13:52     В чём ошибка???((( #6

Не по теме:

я тя за язык не тянул


Yandex
Объявления
27.10.2009, 13:52     В чём ошибка???(((
Ответ Создать тему
Опции темы

Текущее время: 14:36. Часовой пояс GMT +3.
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Рейтинг@Mail.ru