Link to home
Start Free TrialLog in
Avatar of davidlars99
davidlars99Flag for United States of America

asked on

Beginning C++...

this question continues from https://www.experts-exchange.com/questions/21138240/Want-to-Learn-C.html   I get more curious about C++ as I get more info about it, well I guess it's OK for the beginner right..? :)
this is some randomly gotten C++ code, and I was wondering how do I make use of it, or to be more exact, how to run it

thank you
  dave
SOLUTION
Avatar of Axter
Axter
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hm, which code are you talking about?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of davidlars99

ASKER

ohh, I forgot the code

#include "ccc_win.cpp"

using namespace std;

int main()
{

      // Define constants.

      const double XMIN = 0.0; // Minimum x coordinate value (cm).
      const double XMAX = 15.0; // Maximum x coordinate value (cm).
      const double YMIN = 0.0; // Minimum y coordinate value (cm).
      const double YMAX = 15.0; // Maximum y coordinate value (cm).
      const double OFFSET = 1.5; // Offset for "Area =" phrase (cm).

      // Set coordinate system.

      cwin.coord(XMIN, YMAX, XMAX, YMIN);

      // Get corners from user.

      Point pul = cwin.get_mouse("Click on upper left corner");
      cwin << pul;
      Point plr = cwin.get_mouse("Click on lower right corner");
      cwin << plr;

      // Complete rectangle.

   Point pll(pul.get_x(), plr.get_y()); // Lower left corner.
   Point pur(plr.get_x(), pul.get_y()); // Upper right corner.
      cwin << pur << pll; // Display points.
      Line left(pll, pul);
      Line top(pul, pur);
      Line right(pur, plr);
      Line bottom(plr, pll);
      cwin << left << top << right << bottom; // Draw lines.

      // Calculate and output area.

      double area = (pul.get_y() - pll.get_y()) * (plr.get_x() - pll.get_x());
   double xm = (pll.get_x() + plr.get_x()) / 2.0;
      double ym = (pll.get_y() + pul.get_y()) / 2.0;
      Point center(xm, ym);
      Point left_of_center(xm - OFFSET, ym);
      cwin << Message(center, area) << Message(left_of_center, "Area =");

      // Everything worked.

      return 0;
}
GNU is good, but if you are on a windows platform, MinGW (http://www.mingw.org/) might suit you better.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks guys, I really don't care either it's free or not I just need the compiler which will be 100% fully functional with no limitations :). It's just makes me to feel more secure and cozy, well I guess I'm a little more demandive for the beginner, but like I said I have to feel completely equiped for start..    :):)
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hey... isn't that from ugly friend Microsoft? I think I found really good deal on that check this out
http://www.amazon.com/exec/obidos/ASIN/B000089GKU/103-8318846-3135008

used version is for $600.00, but is that complete edition, I mean 100% complete?
Axter, I was very curious about your question history and I just viewed one https://www.experts-exchange.com/questions/21102718/Transparent-window-or-Circular-window.html seems like you still did not get the answer you expected I suppose...  
here is what you might be exactly looking for, www.frozendev.com It has some semi-heavy Javascript, but I don't think there's anything that "C++ guy" might not guess... :)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fattumsdad
fattumsdad

Sorry, forgot to post the link: http://www.parinya.ca/
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks Axter, one more question. Is C++ code same for every platform? what I mean this is, let's say I wrote some program on windows, compliled it and I'm happy, it works, then I took exactly the same code and compiled it on any other platform, would that still be 100% functional? would it still work?
can you please go back and answer my last post here?
https://www.experts-exchange.com/questions/21138240/Want-to-Learn-C.html
fattumsdad, why you were unhappy?
> I was unhappy with Dev-C++ and Eclipse
I tried Dev-C++ about a month ago, and switched to MinGW.  A lot of the code I wrote that worked on VC++ 6.0 would NOT work with Dev-C++ but would work with MinGW and vice versa.  In my opinion, MinGW is the closest you can get to VC++.  If you can afford VC++, then by all means that's the way to go (as stated above).  
That's the one you WANT if you can afford it.  That's VC++ :)