It's a problem from the "Engineering Problem Solving C++ 3rd edition" p. 302 #28:
Write a program that simulates the deseign shown in Figure 6.17 using a component reliability of 0.8 for component 1, 0.85 for component 2, and 0.95 for component 3. Print the estimate of the reliability using 5,000 simulations. (The analytical reliability of the system is 0.794.)
C:\Users\owner\Documents\cse206>g++ prog4.cpp
prog4.cpp: In function 'int main()':
prog4.cpp:18:10: error: no match for 'operator>>' in 'std::cout >> "Enter the nu
mber of trials: \012"'
prog4.cpp:18:10: note: candidates are:
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/basic_string.tcc:998:5: n
ote: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_Cha
rT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_s
tring<_CharT, _Traits, _Alloc>&)
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/istream.tcc:957:5: note:
template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std
::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/istream.tcc:925:5: note:
template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::
operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/istream:709:5: note: template<
class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_ist
ream<char, _Traits>&, unsigned char&)
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/istream:714:5: note: template<
class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_ist
ream<char, _Traits>&, signed char&)
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/istream:756:5: note: template<
class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_ist
ream<char, _Traits>&, unsigned char*)
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/istream:761:5: note: template<
class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_ist
ream<char, _Traits>&, signed char*)
prog4.cpp:25:40: error: expected ';' before ')' token
prog4.cpp:30:24: error: too few arguments to function 'double rand_float(double,
double, double)'
prog4.cpp:8:12: note: declared here
prog4.cpp:31:24: error: too few arguments to function 'double rand_float(double,
double, double)'
prog4.cpp:8:12: note: declared here
prog4.cpp:32:24: error: too few arguments to function 'double rand_float(double,
double, double)'
prog4.cpp:8:12: note: declared here
prog4.cpp:36:3: error: expected ')' before '{' token
prog4.cpp:39:2: error: expected primary-expression before '}' token
prog4.cpp:39:2: error: expected ';' before '}' token
prog4.cpp: In function 'double rand_float(double, double)':
prog4.cpp:52:44: error: expected ')' before ';' token
cout << "Enter the indvidual component reliability: \n";
cout >> "Enter the number of trials: \n"; // error occurs on this line.
If you navigate to the error the line occurs (line 2 in the snippet above) and you look at the previous use of cout which did not result in an error (line 1 in the snippet above) do you notice any differences?
In addition to the improper use of cout that cire mentioned you have the foloowing problems also:
Line 8: rand_float is declared to take 3 arguments.
Line 30,31,32: rand_float is called with only one argument. Does not match the forward declaration at line 8.
Line 50: Implementation of rand_float takes 2 arguments. This doesn't match either the prototype or the calls. Prototype, calls and implementation MUST match.
Line 25: Unmatched parenthises.
Line 32: Extraneous parenthises
Line 52: Unmatches parenthises
PLEASE USE CODE TAGS (the <> formatting button) when posting code. It makes it easier to respond to your post.