Author Topic: CodeBlocks newby question  (Read 5152 times)

calculus

  • Guest
CodeBlocks newby question
« on: February 07, 2011, 04:22:01 pm »
Hi there,

I have found some sample code on the internet and was playing around with it in order to understand what it does. The code is for the class is:

#ifndef EUROPEANOPTION_H_INCLUDED
#define EUROPEANOPTION_H_INCLUDED

#include <string>

class EuropeanOption
{
private:

   void init();   // Initialise all default values
   void copy(const EuropeanOption& o2);

   // 'Kernel' functions for option calculations
   double CallPrice() const;
   double PutPrice() const;
   double CallDelta() const;
   double PutDelta() const;


public:
   // Public member data for convenience only
   double r;      // Interest rate
   double sig;      // Volatility
   double K;      // Strike price
   double T;      // Expiry date
   double U;      // Current underlying price
   double b;      // Cost of carry

   string optType;   // Option name (call, put)

};


However, I am getting the following error on the line in bold: 'string' does not use name type.

Am I calling the <string> class incorrectly? Also how does CodeBlocks add classes like string and math.h? Do I have to install them or are they already in the compiler?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: CodeBlocks newby question
« Reply #1 on: February 07, 2011, 04:27:15 pm »
string and math.h are not classes, but header-files and can be provided by the compiler or not, depends on your compiler and version.
C::B isnot a compiler, but an IntegratedDevelopmentEnvironment.
You seem to miss the absolute basics of programming.
You should try to find a website/forum, that supports basic programming questions or (better) buy yourself a good book about programming.

This forum/site is not such a site and your question is violating our forum rules therfore.

If you have questions related to C::B or how to set special parameters in C::B, feel free to start a new topic.

Topic locked !

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7590
    • My Best Post
Re: CodeBlocks newby question
« Reply #2 on: February 07, 2011, 05:12:04 pm »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org