Automated Dictation Evaluation I
These days kids are introduced to computers at a very early age and in some schools, the dictation test is conducted using computers. The teachers found it a bit difficult to evaluate these tests and they requested the school management to lessen their burden by automating this task. The 12th class students are learning C++ programming and they took up the task of automating the dictation evaluation. You need to check if the given string is equal to the correct string to evaluate each student. Can you please help them out? Write a C++ program to compare 2 strings using strcmp() function.
Answers
Answered by
1
Answer:
hope its help you chggjs
Attachments:
Answered by
0
Answer:
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char s1[50],s2[50];
cin>>s1>>s2;
strcmp(s1,s2);
if(strcmp(s1,s2)==0)
cout<<"It is correct";
else
cout<<"It is wrong";
}
Explanation:
1. Declaartion of two character arrays
2. strcmp function is used to compare the two strings whether both the strings are equal or not if both are equal it returns 0 else returns a positive integer
3. Declaartion of two character arrays
4. checking the condition wheter the value returnd nby function equals 0 or not if true it will print it is correct
Similar questions
English,
5 months ago
Social Sciences,
5 months ago
History,
5 months ago
English,
11 months ago
Science,
11 months ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago