-8

this my program...

{
    char name[5];
    cout << "NPM : ";
    cin >> name;
    cout << "  name: " << name <<endl;
}

make the display name, birth date, with the provisions of each letter can not be more, if more then error. use array function !! how to input data if more array notice error..?

DingusKhan
  • 123
  • 1
  • 15

1 Answers1

2
{
   char name[5];
   cout << "NPM : ";
   cin.getline(name, 5);
   cout << "   name: " << name << endl;
}

Would be possible approach if you HAVE to use char arrays.

The maxlenght for the String itself will be 4 characters long, because char[4] will be a Nullbyte ( '\0' )

Insax
  • 612
  • 4
  • 10