Hi this is a C program. I need you to convert it to a C++ program.
Hi this is a C
here is the program:
#include <stdio.h>
#include <string.h>
int main()
{
char pass[100], guess[100]; //character arrays to store inputs
printf("input password: ");
scanf("%s",pass); //input pass
while(1) //infinite loop
{
printf("enter your password: ");
scanf("%s",guess); //input guess
if(strcmp(pass,guess)==0) //if pass and guess are same
{
printf("correct!"); //prints this message
break; //exits from loop
}
else //if pass and guess mismatch
printf("incorrect!\n");
}
return 0;
}
Step by step
Solved in 3 steps with 1 images