Variable de type string dans une méthode
bonjour à tous,
Merci de m'avoir bien aidé avant hier, ça 'ma beaucoup dépanné. j'ai avancé cahin caha aujourd'hui et j'ai de nouveau un nouveau petit problème quand à la déclaration d'une nouvelle méthode. J'aimerais mettre en variable un string. Or, je n'y arrive pas.
beton.h
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
#ifndef BETON_H_INCLUDED
#define BETON_H_INCLUDED
#include <string>
#include <math.h>
class Beton
{
public:
Beton();
void assignerHauteur(double h);
void assignerLargeur(double h);
void assignerEnrobage(double h);
void assignerMoment(double h);
void assignerTranchant(double h);
void assignerFck(double h);
void assignerFyk(double h);
void assignerClassAcier(string h);
double getAs();
void calculurd();
void calculw();
void calculAs();
private:
double hauteur;
double largeur;
double enrobage;
double moment;
double tranchant;
double fck;
double fyk;
double fcd;
double fyd;
double euk;
double urd;
double w;
double As;
//double Ass;
//double Asw;
};
#endif // BETON_H_INCLUDED |
beton.cpp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#include "Beton.h"
Beton::Beton()
{
// blabla
void Beton::assignerClassAcier(string h) // assigne class de l'acier
{
if(h="A")
{
Beton::euk= 0.025;
}
if(h="B")
{
Beton::euk= 0.05;
}
if(h="C")
{
Beton::euk= 0.06;
}
}
} |
erreur:
Citation:
Beton.h:20: error: 'string' has not been declared
Beton.cpp:13: error: variable or field 'assignerClassAcier' declared void
Beton.cpp:13: error: 'string' was not declared in this scope
mingw32-make[1]: *** [debug/Beton.o] Error 1
mingw32-make[1]: Leaving directory `D:/c++/beton'
mingw32-make: *** [debug] Error 2
Manifestement, il ne reconnait pas le type string. Quelqu'un aurait-il une idée?:oops:
Merci d'avance ;-)