Thanks in advance for your help. I am supposed to create a program that allows user input for a code. The program will then read the array and output the letter on the keyboard one character to the left of the inputted strings. I am first trying to get the top row of the keyboard to output correctly before finishing off the rest of the program, but I don't get the output I am expecting. What am I doing wrong?
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main()
{
//define array1, 2, 3
char Code[] = {'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'};
char Code2[10];
string dCode;
cout << "Enter the code you wish decoded: ";
cin >> dCode;
cout << endl;
int size;
char Code3[size];
size = dCode.length();
char ans[size];
for(int i = 0; i < size; i++)
{
Code2[i] = dCode[i];
for(int h = 0; h < size; h++)
{ if (Code2[i] == Code[i])
cout << dCode[h - 1];
}
}
cout << endl;
system ("pause");
return 0;
}