Thnaks, that will prevent me from making future errors. I am still getting over 100 errors when I try to compile. Here is the new code.
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
//program to average absolute values
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
//a,b,c,d,e variables obtain user input below, these will be changes to
//their absolute values
int a,b,c,d,e,f,g,h,i,j;
cout << "Input 5 numbers please. \n";
cin << a;
cout << "\n1... \n";
cin << b;
cout << "\n2... \n";
cin << c;
cout << "\n3... \n";
cin << d;
cout << "\n4... \n";
cin << e;
cout << "\n5... \n";
//f,g,h,i,j are defined to retain the original values of a,b,c,d,e
//they will remain the user inputed values
a=f;
b=g;
c=h;
d=i;
e=j;
//x,y,z,p,q are made to recive the absolute values of a,b,c,d,e
int x,y,z,p,q;
x=abs(a);
y=abs(b);
z=abs(c);
p=abs(d);
q=abs(e);
cout << "\nThe absolute value of " << f << " is " << x << ".";
cout << "\nThe absolute value of " << g << " is " << y << ".";
cout << "\nThe absolute value of " << h << " is " << z << ".";
cout << "\nThe absolute value of " << i << " is " << p << ".";
cout << "\nThe absolute value of " << j << " is " << q << ".";
cout << "\n";
double average;
average=(x+y+z+p+q)/5.0;
cout << "The average of your values is: " << avreage << ".";
return 0;
}
|
The errors will not all fit but i'll place a few as most of them are the same.
Errors:
absolute.cpp
absolute.cpp(15) : 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::istream'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(930) : see declaration of 'std::operator <<'
absolute.cpp(15) : 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::istream'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(930) : see declaration of 'std::operator <<'
absolute.cpp(15) : 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::istream'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(930) : see declaration of 'std::operator <<'
absolute.cpp(15) : 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::istream'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(923) : see declaration of 'std::operator <<'
absolute.cpp(17) : 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::istream'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(909) : see declaration of 'std::operator <<'
Again thanks for taking a look,
enduser000