Bonjour
Comme indiquer dans le titre j'ai deux erreur de compilation dans le code qui suit :

main.cpp

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <ctime>//peut etre inutile si dans le header 
#include <cstdlib>//idem
#include <string>//idem
 
#include "melangersLettre.h"
using namespace std;
 
int main()
{
    string motMystere,motMelange,motUtilisateur;
    srand(time(0));
    cout<<"Veuillez saissire le mot : "<<endl;
    cin>>motMystere;
    motMelange=melangersLettre(motMystere);
    cout<<motMelange<<endl;
    return 0;
}
melangerLettre.cpp

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "melangersLettre.h"
 
string melangersLettre(string mot)
{
    int position;
    string melange;
    while(mot.size()!=0)
    {
        position=rand()%mot.size();
        melange+=mot[position];
        mot.erase(position,1);
    }
        return melange;
}
melangersLettre.h

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
#ifndef MELANGERSLETTRE_H_INCLUDED
#define MELANGERSLETTRE_H_INCLUDED
#include<string>
#include<ctime>
#include<cstdlib>
 
string melangersLettre(std::string mot);
 
#endif // MELANGERSLETTRE_H_INCLUDED
et ici la synthese du compilateur

||=== Build: Debug in motMystere (compiler: GNU GCC Compiler) ===|
E:\projetc++\formation2017\open classroom\les bases c++chap1a9\tp\essaitp\motMystere\melangersLettre.h|7|error: 'string' does not name a type|
E:\projetc++\formation2017\open classroom\les bases c++chap1a9\tp\essaitp\motMystere\main.cpp||In function 'int main()'
E:\projetc++\formation2017\open classroom\les bases c++chap1a9\tp\essaitp\motMystere\main.cpp|14|error: 'melangersLettre' was not declared in this scope|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Je vous remercie d'avance