the error im getting is
addplanet.c looks like thisCode:g++ -ofinalprog planet.c input.c input2.c addplanet.c addplanet.c: In function `double add_planet(std::vector<double, std::allocator<double> >&)': addplanet.c:9: error: invalid operands of types `double' and `<unknown type>' to binary `operator<<' addplanet.c:10: error: invalid operands of types `double' and `<unknown type>' to binary `operator<<' addplanet.c:11: error: invalid operands of types `double' and `<unknown type>' to binary `operator<<' addplanet.c:13: error: initializer expression list treated as compound expression addplanet.c:14: error: initializer expression list treated as compound expression addplanet.c:20: error: `surface_area' cannot be used as a function addplanet.c:21: error: `density' cannot be used as a function addplanet.c:22: error: `gravity' cannot be used as a function
can someone explain to me what is wrong, i cannot figure out what the problem isCode:#include <iostream> #include <string> #include <vector> #include "input.h" using namespace std; double add_planet(vector<double>& planet_info) { double name=input_planet("The name of the planet is ")<<endl; double mass=readDouble("The mass of the planet is ",false)<<endl; double radius=readDouble("The radius of the planet is ",false)<<endl; double surface_area(radius); double density(mass,radius); double gravity(mass,radius); planet_info.push_back(name); planet_info.push_back(mass); planet_info.push_back(radius); planet_info.push_back(planet_type()); planet_info.push_back(surface_area(radius)); planet_info.push_back(density(mass,radius)); planet_info.push_back(gravity(mass,radius)); }



LinkBack URL
About LinkBacks



I used to be an adventurer like you... then I took an arrow to the knee.