44: Write a program that takes name as input and if it has characters more than 15 it outputs Name cannot have more than 15 characters otherwise output Welcome name
// Write a program that takes name as input and if it has characters more than 15
// it outputs Name cannot have more than 15 characters
// Otherwise output Welcome name
#include <iostream>
using namespace std;
int main()
{
int charcters;
string name;
cout << "Enter your name: ";
getline(cin, name);
name.length() <= 15 ? cout << "Welcome " << name << endl :
cout << "Name cannot have more than 15 characters \n";
return 0;
}
Comments
Post a Comment