Ok I Recently got into my book and i am up to functions and how they work and i am a bit confused maybe someone can explain better then my book is or use a better example.....
im not grasping how this works exactly......Code://sqrt.cpp -- use a square root function #include <iostream> #include <cmath> using namespace std; int main() { double cover; //use double for real numbers cout << "How many square feet of sheets do you have?" << endl; cin >> cover; double side; //create another variable side = sqrt(cover); // call function, assign return value cout << "You can cover a square side of " << side; cout << " feet\nwith your sheets.\n"; cin.get(); cin.get(); return 0; }




Reply With Quote