I tried them both out but they didn't seem to work, i may be doing something wrong but that doesn't really matter right now, ill learn it later I'm just friggin confused with this. When i input this code it's supposed to find the average of the integers or something.
It's not the best code in the world but im still learning. Anyways, a while back i made a code that multiplied two seperate integers that were input (aren't i amazing), this is relavent i guess because whenever i try to run this code, it keeps popping up my multiplication code. I mean WTF!!!!Code:#include <cstdarg> #include <iostream> using namespace std; double average ( int num, ... ) { va_list arguments; double sum = 0; va_start ( arguments, num ); for ( int x = 0; x < num; x++ ) sum += va_arg ( arguments, double ); va_end ( arguments ); return sum / num; } int main() { cout<< average ( 3, 12.2, 22.3, 4.5 ) <<endl; cout<< average ( 5, 3.3, 2.2, 1.1, 5.5, 3.3 ) <<endl; cin.get(); }![]()



LinkBack URL
About LinkBacks




