I need the first and last names to be capitalized, so if the user inputs a lowercase, it'll change it to uppercase when it's displayed. But it's just the ASCII and I'm not sure how to fix it. Thanks!

#include <iostream>
#include <cctype>

using std::cout;
using std::cin;
using std::toupper;

char firstname[15],
     lastname[15];
int f = 0,
    l = 0;

int main()
{
    cout << "Enter your last name: " ;
    cin >> lastname;

    cout << "Enter your first name: " ;
    cin >> firstname;

    f = toupper (firstname[0]);
    l = toupper (lastname[0]);

    cout << "Welcome " << firstname << " " << lastname << '\n';
    cout << "Access granted. Please proceed." << '\n';

return 0;
}

Don't know if thisa is best way, but appears to work for me.

#include "stdafx.h"
#include <iostream>
#include <cctype>

using std::cout;
using std::cin;
using std::toupper;
char firstname[15],
     lastname[15];

int main()
{
    cout << "Enter your last name: " ;
    cin >> lastname;
    cout << "Enter your first name: " ;
    cin >> firstname;
    firstname[0] = toupper (firstname[0]);
    lastname[0] = toupper (lastname[0]);
    cout << "Welcome " << firstname << " " << lastname << '\n';
    cout << "Access granted. Please proceed." << '\n';
return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.