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
|
#include "stdafx.h"
#include<iostream>
#include<iomanip>
int _tmain(int argc, _TCHAR* argv[]) // Allows VS Express to run without header and error free
{
return 0;
}
// Start Of Assignment
using std::cin;
using std::cout;
using std::endl;
using std::setw;
int main()
// Declaring The Arrays - Pointers
// Printing Concepts
{
char pletter2[26]= { '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';
char* pphrase6 = "PRINTING CONTENTS OF THE ARRAY USING MOD OPTION";
char* pphrase7 = "===============================================";
int number = 0;
cout<<endl;
cout <<pphrase;
cout <<endl;
cout <<pphrase2;
cout <<endl;
for(int i = 0; i < 26; i++) // Elements with counter
{
cout <<pletter2[i];
}
cout <<endl;
cout <<endl;
cout <<"Review the alphabet above and enter the coinciding number of the letter: "<<endl; // Prompting for number entry
cout <<endl;
cout <<"The Letter A is 0, Letter B is 1, Letter C is 2, and so on.."<<endl; // Brief example
cin >>number;
if ( number >=1 && number <=26) // If the number 1-26 is entered the following engages
{
cout <<"Selected Number: "<<number<<endl;
cout <<"The letter that represents that number is: "<<pletter2[number-1]<<endl;
}
else
{
cout<<"There has been a problem with your selection try again please!"<<endl;
}
cout <<endl;
cout <<endl;
cout << pphrase3;
cout <<endl;
cout <<pphrase4;
cout <<endl;
for(int i = 1; i < 2; i = i +2) // Replacing X with every other letter after A
{
pletter2[i] = pphrase5;
for(int j = 0; j<26; j = j+2)
cout <<pletter2[j]<<pletter2[i];
cout <<endl;
}
cout <<endl;
cout <<endl;
cout <<endl;
cout <<pphrase6;
cout <<endl;
cout <<pphrase7;
int i;
for(int i=0; pletter2[i] !='\0' ; i++)
{
if ((pletter2[i] & 1) == 0) // Detecting if selection is EVEN
i=i+1;
cout <<endl;
cout <<"Even Numbered Element "<<i<<" Contents of Element within Array is "<<pletter2[i];
cout <<endl;
}
{
}
return 0; // returns
} // End of application
|