For Loop with array

Hey I posted in a dead forum so I figured I would make my own thread. I am working on this homework and I have to replace every other letter after A with a lower case x. This has to be done with a for loop and cannot be done physically by altering the array. So far I have this and it will only output the lower case x's and I was just wondering how I could rectify the problem and have it output the rest of the array. Thanks much this has been annoying because I know I am close.
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
// Arrays and Pointers program for Assignment week 4

#include<iostream>
#include<iomanip>

using std::cin;
using std::cout;
using std::endl;
using std::setw;

	int main()
	{
		
		char* pletter2[]=  { "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z" };
		char* pphrase = "PRINTING CONTENTS OF THE ARRAY";
		char* pphrase2 = "==============================";
		char* pphrase3 = "PRINTING CONTENTS OF THE ARRAY and adding x to every other element";
		char* pphrase4 = "==================================================================";
		char* pphrase5 = "x";
		
		int number = 0;
		int i;
	    

		    cout<<endl;
			cout <<pphrase;
		    cout <<endl;
		    cout <<pphrase2;
			cout <<endl;

	     for(int i = 0; i < 26; i++)
		{
			
		    
			 cout <<pletter2[i];
			
		
		}
          
			cout <<endl;
			cout <<endl;
		    cout <<"Please enter a number between 1 and 26 that corresponds to a letter in the alphabet: "<<endl;
		    cout <<endl;
			cout <<"Example: The number 10 corresponds to the letter J."<<endl;
			cin >>number;

		 if ( number >=1 && number <=26)
		 {
			     cout <<"The number you selected is: "<<number<<endl;
		         cout <<"The letter that corresponds with that number is: "<<pletter2[number-1]<<endl;
		 }
		          else 
		 {
			         cout<<"There was an error with your input please try again"<<endl;
		 }
		 
		 
		 {	
			
			 
		 int j = 0;

         cout <<endl;
		 cout << pphrase3;
		 cout <<endl;
		 cout <<pphrase4;
		 cout <<endl;

			for(j = 1; j <= 26; j = j +2)
            {
              
			    pletter2[j] = pphrase5;
				   cout <<pletter2;
             }
			
	    
		    
			
			return 0;
		}
	
	}

The only part I should have to alter is the very last for loop which is

1
2
3
4
5
6
for(j = 1; j <= 26; j = j +2)
            {
              
			    pletter2[j] = pphrase5;
				   cout <<pletter2[j];
             }
Topic archived. No new replies allowed.