Isolating parameters of an array, palindrome

So i have pretty much figured out how to do this code through a series of trial and error and professor assistance. But im stuck on this last part. For some reason when i take the contents of my array of characters, after it has been uppercased through toupper, my loop isnt wanting to isolate just the alphabet and numbers. Can someone please give me at least a hint in the right direction???

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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#include <iostream>
#include <string>
#include <iomanip> // for set precision

using namespace std;
void center(string display);      // Functions
void showMenu();
void palindrome();
void stringinput(char*);






int main() //main

{
	char choice;

	//Constants for the menu choice
	cout << fixed << showpoint << setprecision (2);     //Set decimal point to two figures (1/100th)

	do
	{
		fflush(stdin);
		//Display the menu and get the user's choice.
		showMenu();

		while (! (cin >> choice) || !(choice == '1' || choice == '2' || choice == '3')) // Validate the menu selection.
			//Loop , and the the user input of what choice to do
		{
			center( "Are you drunk?? thats invalid order.");
			cout<< endl;
			cin.clear();
			fflush(stdin); // Clear Input buffer.
			center ("Re-Enter your choice : ");


		}

		switch (choice)                             //Switch menu choices
		{
		case '1': // Box choice
			palindrome();



		case '2': // Rainfall statistics choice
			fflush(stdin);
			cout << endl;
			center("Rainfall Statistics : ");

			break;

		case '3': // end program choice
			center ("Programmer: Andrew Holder");
			cout << endl;
			center ("BYE BYE!!! Press <Enter> key to END the program...");

			fflush(stdin);
			cin.get();
			break; 
		}

		system("CLS"); //Clears screen and then reloops for the entire program
	}

	while (choice!= '3'); // THis is part of the do while loop that keeps continuing until you pick end program.


	cout << endl << endl;
	fflush(stdin);
	return 0;

} 

void palindrome()
{

	char word[80];

	cout << "Please input a word and press return" << endl;
	fflush(stdin);
	stringinput(word);



}
void stringinput(char* word)
{
	bool palindrome=true;
	char temp[80];
	int i =0;
	cin.getline(word, 80);
	for( int i=0 ; i < strlen(word); i++ ) 
		word[i] = toupper( word[i] );
	for (unsigned i = 0; i < strlen(word); i++)  //unsigned is positive integer
	{	
		if  ((word[i]>= 48 && word[i] <=57) || (word[i]>=65 && word[i]<=90))  // only takes numbers and alphabets and puts
			// and puts them into temp array.
		{	

			temp[i]=word[i];
		}

	}

	for(int i = 0; i< 80; i++)
	{
	cout << temp[i];
	}
      char *front = temp,*rear = (temp + strlen(temp)) - 1;  
	 

      for(int i =0; front<=rear; front++,rear--)
	  {  
		  

	  

        if(*front != *rear) 
		{
			palindrome=false;
			break;
		}
		


	

	//cin.get();
	  }
		
	  if (palindrome==true)
	  { 
		cout << "The word is a palindrome" << endl; 
		fflush(stdin);
		cin.get();
	
	}

	else
	{
		cout << "The word is not a palindrome" << endl; 
		fflush(stdin);
		cin.get();
	}

}
In line 111, i put a test there to see what was being stored and its a whole bunch of gobbly goop . thanks in advance you guys!
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
void stringinput(char* word)
{
	bool palindrome=true;
	char temp[80] = {' '};
	int i =0;
	int count = 0;
	cin.getline(word, 80);
	for( int i=0 ; i < strlen(word); i++ ) 
		word[i] = toupper( word[i] );
	for (unsigned i = 0; i < strlen(word); i++)  //unsigned is positive integer
	{	
		if  (isalpha(word[i]) || isdigit(word[i]))  // only takes numbers and alphabets and puts
			// and puts them into temp array.
		{	

			temp[count] = word[i];
			count++;
		}

	}

	for(int i = 0; i< strlen(word); i++)
	{
		cout << temp[i];
	}
good looking bro, but the cout will still print out the symbols of the input in a very strange fashion if they are at the end of the string. Do you have any idea why that might be??? something to do with the null terminator??? i have no idea, huge beginner. Thank u dude for responding and even if i dont put any symbols or spaces in standard input, the cout does in fact make them all uppercase, but a palindrome like MADAM is coming back false....:/// What small glitch am i messing up on?? my algorithim seems to be right...

NEVER MIND!!! YOUR THE MAN! But for informational purposes, could you explain why initiliazing temp array { ' '} did the trick??? all of a sudden the program works could you explain that to me??? thanks alot man!
Topic archived. No new replies allowed.