serubbabel
Aktives Mitglied
Thread Starter
- Dabei seit
- 15.07.2003
- Beiträge
- 268
- Reaktionspunkte
- 0
Hallo!
Bin absoluter Anfänger und habe da ein Problem beim compilieren von einnfachen c++ Programmen. Vielleicht kennt sich hier ja einer aus und schaut sich das mal an.
Also das ist das Prog:
//mittelwert
#include <iostream.h>
int main()
{
int n = 0;
double summe=0;
double werte[10];
cout << "Anzahl der Werte = ";
cin >> n;
for(int i=0;i < n; i++){
cout >> "Wert" << i << " = ";
cin >> werte [n];
}
for(int j=0;j<n; j++){
summe=summe+werte[j];
}
cout << "Summe = " << summe << "\n";
cout << "Mittelwert = " << summe/n;
cin >> "";
}
und dies die Fehkermeldung vom compiler:
Kai-s-Computer:~/documents/c++ Kai$ g++ mittelwert.cpp
mittelwert.cpp: In function `int main()':
mittelwert.cpp:16: error: no match for `std:stream& >> const char[5]'
operator
mittelwert.cpp:26: error: ambiguous overload for `std::istream& >> const
char[1]' operator
/usr/include/gcc/darwin/3.3/c++/istream:695: error: candidates are:
std::basic_istream<char, _Traits>& std:perator>>(std::basic_istream<char,
_Traits>&, signed char*) [with _Traits = std::char_traits<char>] <near
match>
/usr/include/gcc/darwin/3.3/c++/istream:690: error:
std::basic_istream<char, _Traits>& std:perator>>(std::basic_istream<char,
_Traits>&, unsigned char*) [with _Traits = std::char_traits<char>] <near
match>
Vielen Dankl schon mal!
Bin absoluter Anfänger und habe da ein Problem beim compilieren von einnfachen c++ Programmen. Vielleicht kennt sich hier ja einer aus und schaut sich das mal an.
Also das ist das Prog:
//mittelwert
#include <iostream.h>
int main()
{
int n = 0;
double summe=0;
double werte[10];
cout << "Anzahl der Werte = ";
cin >> n;
for(int i=0;i < n; i++){
cout >> "Wert" << i << " = ";
cin >> werte [n];
}
for(int j=0;j<n; j++){
summe=summe+werte[j];
}
cout << "Summe = " << summe << "\n";
cout << "Mittelwert = " << summe/n;
cin >> "";
}
und dies die Fehkermeldung vom compiler:
Kai-s-Computer:~/documents/c++ Kai$ g++ mittelwert.cpp
mittelwert.cpp: In function `int main()':
mittelwert.cpp:16: error: no match for `std:stream& >> const char[5]'
operator
mittelwert.cpp:26: error: ambiguous overload for `std::istream& >> const
char[1]' operator
/usr/include/gcc/darwin/3.3/c++/istream:695: error: candidates are:
std::basic_istream<char, _Traits>& std:perator>>(std::basic_istream<char,
_Traits>&, signed char*) [with _Traits = std::char_traits<char>] <near
match>
/usr/include/gcc/darwin/3.3/c++/istream:690: error:
std::basic_istream<char, _Traits>& std:perator>>(std::basic_istream<char,
_Traits>&, unsigned char*) [with _Traits = std::char_traits<char>] <near
match>
Vielen Dankl schon mal!