Solution To Alphabet Test Question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Solution To Alphabet Test Question

I'm learning C++ and I'm stuck at arrays, probably the first coding test on arrays. --Alphabet-- I wrote the code and after running it, Test Case 1 & 2 were alright yet the code is declared to be wrong. Anyone who's dealt with it should kindly sort me out please🙏🙏

5th Oct 2023, 2:17 AM
Agent Seven
Agent Seven - avatar
2 Answers
+ 3
Can you share the code?
5th Oct 2023, 4:54 AM
Moree
Moree - avatar
0
Sorry for the late reply although I need help. I'm financially unstable and haven't bought data packet for the past 3 days. Btw, this is the code #include <iostream> using namespace std; int main() { char letters[] = {'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'}; int input; cin >> input; cout << "It corresponds to " << letters[input]; } This is the code to which I seek corrections and guidance. Thank you
9th Oct 2023, 9:58 PM
Agent Seven
Agent Seven - avatar