I know there are some easier ways to perform this but I'm trying to get used to pointers and arrays[samething]. When the user types in the radius it doesn't return the current area.(pie * r2)
Code:#include <iostream> inline float GetArea(float *buffer, float radius) { buffer= new float[5]; buffer[2]= radius * radius; buffer[1]= 3.14; buffer[0]= buffer[2]*buffer[1]; return buffer[0]; } int main(int argc, char **argv) { float mybuffer, radius; cout << "Input the radius: "; cin >> radius; GetArea(&mybuffer, radius); cout << "The Area is: " << &mybuffer; cin.get(); return 0; }



LinkBack URL
About LinkBacks



