Tuesday, March 31, 2015

How to run a program in C++

pqr47.us.company.com: / >
pqr47.us.company.com: / >
pqr47.us.company.com: / >
pqr47.us.company.com: / > cat sqrt.cpp
#include <iostream>
using namespace std;
#include <cmath>
int main()
{
        double cover;

        cout << "How many square feet of sheets do you have ? :  ";
        cin >> cover;
        double side;
        side = sqrt(cover);
        cout << "You can cover a square with sides of " << side << " feet with your sheets. \n";
        return 0;
}
pqr47.us.company.com: / >
pqr47.us.company.com: / >
pqr47.us.company.com: / >
pqr47.us.company.com: / > g++ sqrt.cpp -o square-root
pqr47.us.company.com: / >
pqr47.us.company.com: / >
pqr47.us.company.com: / > ./square-root
How many square feet of sheets do you have ? :  169
You can cover a square with sides of 13 feet with your sheets.
pqr47.us.company.com: / >
pqr47.us.company.com: / >
pqr47.us.company.com: / >

No comments:

Post a Comment