Bonjour tous,
j'ai ajouté à mon programme une petite partie de code (voir ci dessous)
et lorsque je compile à présent code::block ne répond plus et je dois tout fermer.
j'ai essayer de redémarrer l'ordi mais cela n'a rien changé...
Voici le bout de code que j'ai rajouté (certains reconnaitrons leur contribution ):
je suis un débutant donc ne prenez pas peur si mon code n'est pas optimisé, j'ai voulu conserver la méthode la plus facile pour moi et mes collegues qui devront comprendre ce code. remarque: l'erreur vient peut etre de ma convertion char en string qui passe par des tableau... ?
j'espere que vous pourrez m'expliquer d'où cela vient....
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
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82 vector <string> letter; vector <double> number; bool isNumeric(char c); //prototype of character recognize function bool isCapital(char c); //prototype of character recognize function bool isLetter(char c); int stringSize=arg[0].size (); int convertNumber=0; char toDoString1[2]; char toDoString2[3]; char toDoString3[2]; char toDoString4[3]; for (i = 0 ; i < stringSize ; i++) { cout << "caracter " << i << " = " << arg[0].at(i) << endl; if ( isNumeric(arg[0].at(i)) ) //see if the character is a number { if ( isNumeric(arg[0].at(i + 1)) ) //see if the next character is a number { toDoString2[0]=arg[0].at(i); toDoString2[1]=arg[0].at(i+1); toDoString2[2]='\0'; istringstream iss99( toDoString2 ); //to convert string in a int iss99 >> convertNumber; number.push_back( convertNumber ); } else if ( isCapital(arg[0].at(i + 1)) || isLetter(arg[0].at(i + 1)) ) { toDoString1[0]=arg[0].at(i); toDoString1[1]='\0'; istringstream iss99( toDoString1 ); //to convert 2 char in double iss99 >> convertNumber; number.push_back( convertNumber ); } else { cout << "wrong caracter in database, for name" << endl; break; } } else if ( isCapital(arg[0].at(i)) || isLetter(arg[0].at(i)) ) // see if the character is a capital letter or normal letter { if ( isCapital(arg[0].at(i + 1)) ) { toDoString4[0]=arg[0].at(i); toDoString4[1]=arg[0].at(i+1); toDoString4[2]='\0'; letter.push_back( toDoString4 ); //string: array of several char } else if ( isNumeric(arg[0].at(i + 1)) ) { toDoString3[0]=arg[0].at(i); toDoString3[1]='\0'; letter.push_back( toDoString3 ); } else { cout << "wrong caracter in database, for name" << endl; break; } } else { cout << "error in definition" << endl; break; } bool isNumeric(char c) { return ( c > 47 && c < 58 ); // (peu aussi écrire c >= '0' && c <= '9' ) } bool isCapital(char c) { return ( c > 64 && c < 91 ); // (peu aussi écrire c >= 'A' && c <= 'Z') } bool isLetter(char c) { return ( c > 96 && c < 123 ); // (peu aussi écrire c >= 'a' && c <= 'z') }
voici le message d'erreur (piece jointe)
Partager