Answer to Question #342387 in C++ for Magisk

Question #342387

Instructions:

  1. In the code editor, you are provided with an array of characters (or a string).
  2. Your task is to ask the user for an integer input which represents the index and then print out the character of the string found at that index.

Code:

#include <iostream>

using namespace std;


int main() {

  char array[100] ="supercalifragilisticexpialidocious";



  return 0;

}


1
Expert's answer
2022-05-18T15:26:22-0400
#include <iostream>




using namespace std;




int main() {




 char array[100] ="supercalifragilisticexpialidocious";

 int index;

 cin>>index;

 cout<<array[index+1]; // or "cout<<array[index];" if starting from zero










 return 0;




}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS