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 34 35 36 37 38 39 40 41 42 43
|
$ make
/usr/bin/g++ -Wall -Wextra -g test.cpp -o test
test.cpp: In function ‘int main()’:
test.cpp:31:27: error: no matching function for call to ‘getline(std::istream&, double&)’
std::getline(cin, number);
^
test.cpp:31:27: note: candidates are:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/string:53:0,
from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/ios:42,
from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/ostream:38,
from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/iostream:39,
from test.cpp:8:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/basic_string.tcc:1068:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&, _CharT)
getline(basic_istream<_CharT, _Traits>& __in,
^
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/basic_string.tcc:1068:5: note: template argument deduction/substitution failed:
test.cpp:31:27: note: mismatched types ‘std::basic_string<_CharT, _Traits, _Alloc>’ and ‘double’
std::getline(cin, number);
^
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/string:52:0,
from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/ios:42,
from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/ostream:38,
from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/iostream:39,
from test.cpp:8:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/basic_string.h:2812:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)
getline(basic_istream<_CharT, _Traits>& __is,
^
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/basic_string.h:2812:5: note: template argument deduction/substitution failed:
test.cpp:31:27: note: mismatched types ‘std::basic_string<_CharT, _Traits, _Alloc>’ and ‘double’
std::getline(cin, number);
^
test.cpp:32:39: error: cannot convert ‘double’ to ‘double*’ for argument ‘1’ to ‘double ComputeAverage(double*, int)’
bool success = ComputeAverage(number);
^
test.cpp:32:8: warning: unused variable ‘success’ [-Wunused-variable]
bool success = ComputeAverage(number);
^
makefile:10: recipe for target 'test' failed
make: *** [test] Error 1
|