Computer Science, asked by sahilss0410, 9 months ago

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.

INPUT FORMAT:

Input consists of two strings.

Assume that the maximum length of the string is 50 and it contains only alphabets.

OUTPUT FORMAT:

Refer sample input and output for formatting specifications.

SAMPLE INPUT & OUTPUT:

Excellent

Excellent

It is correct ​

Answers

Answered by sristi99132
6

Answer:

I don't know

Explanation:

Answered by sarahssynergy
0

Given below is the C++ program to compare two strings.

Explanation:  

  • C++ programming language offers various string functions such as
  • strcpy (s, s'): copies string s' in string s.
  • strcat (s, s'): concatenates strings s' to the string s that is string s' is joined to string s at its end.
  • strlen(s): calculates the length of the string that the number of characters including spaces in the string.
  • strcmp (s, s'): returns zero if strings s and s' are equal. Hence, This function is used in the below program:                                                                        
  • #include<iostream>                                  
  • #include<cstring>
  • using namespace std;
  • int main(){
  •           char s1[50], s2[50];
  •           cout<< "Enter correct dictation:";
  •            cin>>s1;
  •            cout<< "Enter testing dictation:";            
  •             cin>>s2;  
  •             if(strcmp(s1, s2)==0) { cout<<"It is correct"<<endl; }
  •             else { cout<<"It is wrong."<<endl; }     }

Similar questions