Having trouble with errors

please help me with these errors thank you

#include <iostream>
#include "string"
#include "array"
using namespace std;
string message;
int main(){
int array [26];
cout << "What will you like your coded message to say? (write everything in lower case)";
getline(cin, message);
while(message testChar = message){ //unknown type name 'message'
char testChars[0,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]; //excepted ']'
if (message == testChars) {

}
array[0] = 'a';
array[1] = 'b';
array[2] = 'c';
array[3] = 'd';
array[4] = 'e';
array[5] = 'f';
array[6] = 'g';
array[7] = 'h';
array[8] = 'i';
array[9] = 'j';
array[10] = 'k';
array[11] = 'l';
array[12] = 'm';
array[13] = 'n';
array[14] = 'o';
array[15] = 'p';
array[16] = 'q';
array[17] = 'r';
array[18] = 's';
array[19] = 't';
array[20] = 'u';
array[21] = 'v';
array[22] = 'w';
array[23] = 'x';
array[24] = 'y';
array[25] = 'z';

}
return 0;
}
Can you please explain what are you trying to do with the program?
1) What errors? Are we supposed to just magically read your mind? Why did you decide not to tell us what the errors are?

2) When posting code, please use code tags to make it readable:

http://www.cplusplus.com/articles/z13hAqkS/
Line 3: Why are you including "array". You're not using std::array anywhere.

Line 7: If you're using C++11, array is defined in the std namespace. Not a good idea to use array as a variable name if you are using namespace std with C++11.

Line 10: Your while condition is bogus.

Line 10: testChar is undefined.

Line 10: You're using the assignment operator (=). Did you mean to use the equality operator (==)?

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
closed account (48T7M4Gy)
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
#include <iostream>
#include <string> //<--

using namespace std;

int main()
{
    string message; //<--
    int array [26];
    
    array[0] = 'a';
    array[1] = 'b';
    array[2] = 'c';
    array[3] = 'd';
    array[4] = 'e';
    array[5] = 'f';
    array[6] = 'g';
    array[7] = 'h';
    array[8] = 'i';
    array[9] = 'j';
    array[10] = 'k';
    array[11] = 'l';
    array[12] = 'm';
    array[13] = 'n';
    array[14] = 'o';
    array[15] = 'p';
    array[16] = 'q';
    array[17] = 'r';
    array[18] = 's';
    array[19] = 't';
    array[20] = 'u';
    array[21] = 'v';
    array[22] = 'w';
    array[23] = 'x';
    array[24] = 'y';
    array[25] = 'z';
    
    cout << "What will you like your coded message to say? (write everything in lower case)";
    getline(cin, message);
    
    /*
    while( message testChar = message)
    {unknown type name 'message'
    char testChars[0,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]; //excepted ']'

    if (message == testChars) {}
    */

    return 0;
}

Last edited on
Topic archived. No new replies allowed.