A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 one year ago
C++ question on comparing elements on 2 different arrays
anonymous
 one year ago
C++ question on comparing elements on 2 different arrays

This Question is Closed

e.mccormick
 one year ago
Best ResponseYou've already chosen the best response.0Well, what is the question?

anonymous
 one year ago
Best ResponseYou've already chosen the best response.0oh that is strange the rest of the question not there. sorry question is how to compare elements of 2 string arrays. one array is holding all the correct answers to a test. second array is holding all the answers from the students. The student receives points if the elements are the same from the two arrays

anonymous
 one year ago
Best ResponseYou've already chosen the best response.0well if your question is how to compare elements of two different arrays then all you need to do is: for(int i=0;i<n;i++) { if(arr1[i]==arr2[i]) cout<<i<<"th element matches in both the arrays"; else cout<<i<<"th element in array 1 is "<<arr1[i]<<" and in array 2 is "<<arr2[i]; } here arr1[] is array 1, arr2[] is array 2 and i is a counter variable.

rsmith6559
 one year ago
Best ResponseYou've already chosen the best response.0Because this is string data, the answers need to have their case set too. Either compare them as all uppercase or all lowercase or you'd have to get into Regular Expressions. This URL should help with the comparisons: http://www.cplusplus.com/reference/cstring/
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.