Форум программистов, компьютерный форум, киберфорум
С++ для начинающих
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.71/7: Рейтинг темы: голосов - 7, средняя оценка - 4.71
3 / 3 / 1
Регистрация: 12.10.2009
Сообщений: 81

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

27.10.2009, 13:21. Показов 1432. Ответов 5
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Програма для нахождения площади интеграла

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)\integra l(trapeciya)\integral.cpp(6) : error C2143: syntax error : missing ')' before ';'
1>z:\astrauh\integral(trapeciya)\integra l(trapeciya)\integral.cpp(6) : warning C4091: '' : ignored on left of 'double' when no variable is declared
1>z:\astrauh\integral(trapeciya)\integra l(trapeciya)\integral.cpp(6) : error C2059: syntax error : ')'
1>z:\astrauh\integral(trapeciya)\integra l(trapeciya)\integral.cpp(6) : warning C4091: '' : ignored on left of 'int' when no variable is declared
1>z:\astrauh\integral(trapeciya)\integra l(trapeciya)\integral.cpp(9) : error C2660: 'integral' : function does not take 3 arguments
1>z:\astrauh\integral(trapeciya)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(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)\integra l(trapeciya)\integral.cpp(14) : error C2660: 'integral' : function does not take 3 arguments
1>z:\astrauh\integral(trapeciya)\integra l(trapeciya)\integral.cpp(22) : error C2143: syntax error : missing ')' before ';'
1>z:\astrauh\integral(trapeciya)\integra l(trapeciya)\integral.cpp(22) : error C2059: syntax error : ')'
1>z:\astrauh\integral(trapeciya)\integra l(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(trapeciy a)\integral(trapeciya)\Debug\BuildLog.ht m"
1>integral(trapeciya) - 48 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



помогите разобраться плз
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
27.10.2009, 13:21
Ответы с готовыми решениями:

Ошибка method range of object global failed в чем ошибка
Sub ПроверкаВвода() Dim A As Range Dim B As Range Dim i As...

Ошибка -is not a valid integer value (не является допустимым целым значением), не понимаю в чем ошибка
//--------------------------------------------------------------------------- #include &lt;vcl.h&gt; #pragma hdrstop #include...

Ошибка при передаче параметров в функцию. Объясните, ребят, пожалуйста, в чем ошибка
Есть функция, которую необходимо отобразить в виде линий уровня. Далее с помощью простого симплекс-метода нужно найти минимальное значение...

5
эволюционирую потихоньку
 Аватар для TanT
468 / 466 / 91
Регистрация: 30.06.2009
Сообщений: 1,401
27.10.2009, 13:27
сравни
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);
}
1
3 / 3 / 1
Регистрация: 12.10.2009
Сообщений: 81
27.10.2009, 13:33  [ТС]
щас выдаёт

1>------ Build started: Project: integral(trapeciya), Configuration: Debug Win32 ------
1>Compiling...
1>integral.cpp
1>z:\astrauh\integral(trapeciya)\integra l(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(trapeciy a)\integral(trapeciya)\Debug\BuildLog.ht m"
1>integral(trapeciya) - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
0
 Аватар для kazak
3601 / 2742 / 355
Регистрация: 11.03.2009
Сообщений: 6,300
27.10.2009, 13:34
Строки 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 на фиг.
0
3 / 3 / 1
Регистрация: 12.10.2009
Сообщений: 81
27.10.2009, 13:35  [ТС]
а не спс всё работаёт )) я твой должник)
0
эволюционирую потихоньку
 Аватар для TanT
468 / 466 / 91
Регистрация: 30.06.2009
Сообщений: 1,401
27.10.2009, 13:52

Не по теме:

я тя за язык не тянул ]:->


0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
27.10.2009, 13:52
Помогаю со студенческими работами здесь

Ошибка "Stack around the variable 'text' was corrupted"
Выскакивает ошибка Stack around the voriable 'text' was corrupted. Подскажите пожалуйста в чём ошибка. #include &lt;iostream&gt; ...

В чем ошибка?По одной строке нормально в базу заходят,а две сразу вылетает ошибка?
INSERT INTO `jos_menu` (`id`, `menutype`, `name`, `alias`, `link`, `type`, `published`, `parent`, `componentid`, `sublevel`, `ordering`,...

Реализовать через тип данных структура. При сборке и отладки возникает ошибка. В чем ошибка?
С++ в таблице из 5 строк хранятся данные о товарах: наименование, цена, количество. Определить и вывести наименование товара, цена которого...

Ошибка 2 error LNK2019, не пойму в чем ошибка
Выдает такую ошибку: Ошибка 2 error LNK2019: ссылка на неразрешенный внешний символ &quot;int __cdecl game(void)&quot; (?game@@YAHXZ) в...

В чем ошибка? При запуске программы открывается консоль и сразу ошибка о завершении программы
К тому же выдает warning: deprecated conversion from string constant to 'char*' . #include &lt;iostream&gt; #include &lt;string.h&gt; #include...


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

Или воспользуйтесь поиском по форуму:
6
Ответ Создать тему
Новые блоги и статьи
Советы по крайней бережливости. Внимание, это ОЧЕНЬ длинный пост.
Programma_Boinc 28.12.2025
Советы по крайней бережливости. Внимание, это ОЧЕНЬ длинный пост. Налог на собак: https:/ / **********/ gallery/ V06K53e Финансовый отчет в Excel: https:/ / **********/ gallery/ bKBkQFf Пост отсюда. . .
Кто-нибудь знает, где можно бесплатно получить настольный компьютер или ноутбук? США.
Programma_Boinc 26.12.2025
Нашел на реддите интересную статью под названием Anyone know where to get a free Desktop or Laptop? Ниже её машинный перевод. После долгих разбирательств я наконец-то вернула себе. . .
Thinkpad X220 Tablet — это лучший бюджетный ноутбук для учёбы, точка.
Programma_Boinc 23.12.2025
Рецензия / Мнение/ Перевод Нашел на реддите интересную статью под названием The Thinkpad X220 Tablet is the best budget school laptop period . Ниже её машинный перевод. Thinkpad X220 Tablet —. . .
PhpStorm 2025.3: WSL Terminal всегда стартует в ~
and_y87 14.12.2025
PhpStorm 2025. 3: WSL Terminal всегда стартует в ~ (home), игнорируя директорию проекта Симптом: После обновления до PhpStorm 2025. 3 встроенный терминал WSL открывается в домашней директории. . .
Как объединить две одинаковые БД Access с разными данными
VikBal 11.12.2025
Помогите пожалуйста !! Как объединить 2 одинаковые БД Access с разными данными.
Новый ноутбук
volvo 07.12.2025
Всем привет. По скидке в "черную пятницу" взял себе новый ноутбук Lenovo ThinkBook 16 G7 на Амазоне: Ryzen 5 7533HS 64 Gb DDR5 1Tb NVMe 16" Full HD Display Win11 Pro
Музыка, написанная Искусственным Интеллектом
volvo 04.12.2025
Всем привет. Некоторое время назад меня заинтересовало, что уже умеет ИИ в плане написания музыки для песен, и, собственно, исполнения этих самых песен. Стихов у нас много, уже вышли 4 книги, еще 3. . .
От async/await к виртуальным потокам в Python
IndentationError 23.11.2025
Армин Ронахер поставил под сомнение async/ await. Создатель Flask заявляет: цветные функции - провал, виртуальные потоки - решение. Не threading-динозавры, а новое поколение лёгких потоков. Откат?. . .
Поиск "дружественных имён" СОМ портов
Argus19 22.11.2025
Поиск "дружественных имён" СОМ портов На странице: https:/ / norseev. ru/ 2018/ 01/ 04/ comportlist_windows/ нашёл схожую тему. Там приведён код на С++, который показывает только имена СОМ портов, типа,. . .
Сколько Государство потратило денег на меня, обеспечивая инсулином.
Programma_Boinc 20.11.2025
Сколько Государство потратило денег на меня, обеспечивая инсулином. Вот решила сделать интересный приблизительный подсчет, сколько государство потратило на меня денег на покупку инсулинов. . . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2025, CyberForum.ru