// Your program should ask for a name.
using namespace std;
int main()
{
const int SIZE = 80; // Array size
char line[SIZE], line1[SIZE]; // To hold a line of input
// char myname[SIZE] = { 'V','a','s','i','l','i','y','\0'};
char myname[SIZE] = "Vasiliy";
int count = 0; // Loop counter variable
bool x = true;
// Get a line of input.
cout << "Enter a name of no more than "
<< (SIZE - 1) << " characters:\n";
cin.getline(line1, SIZE);
int k = 0;
for (int i = 0; i < SIZE; i++)
if (line1[i] != ' ' && line1[i] != '\t')
{line[k] = line1[i]; k++;}
// Display the input one character at a time.
while (myname[count] != '\0')
{
if (line[count]!=myname[count])
{
cout << "\n It is not your name!"; x = false; break;
}
count++;
}
if (x) cout << "\nIt is your name";
return 0;
}
// Then the program should recognize if the entered word is your first name
// and make an appropriate message about it.
#include <iostream>using namespace std;
int main()
{
const int SIZE = 80; // Array size
char line[SIZE], line1[SIZE]; // To hold a line of input
// char myname[SIZE] = { 'V','a','s','i','l','i','y','\0'};
char myname[SIZE] = "Vasiliy";
int count = 0; // Loop counter variable
bool x = true;
// Get a line of input.
cout << "Enter a name of no more than "
<< (SIZE - 1) << " characters:\n";
cin.getline(line1, SIZE);
int k = 0;
for (int i = 0; i < SIZE; i++)
if (line1[i] != ' ' && line1[i] != '\t')
{line[k] = line1[i]; k++;}
// Display the input one character at a time.
while (myname[count] != '\0')
{
if (line[count]!=myname[count])
{
cout << "\n It is not your name!"; x = false; break;
}
count++;
}
if (x) cout << "\nIt is your name";
return 0;
}