Hi
I have to build a QT widget using Qt Message box and Qt input dialogue that accepts a full first name and second name, then generates a user name and password. using the below criteria:
It consists of 5 lower case characters.
• The user name is created by combining the first 4 characters of the first name with the first
character of the surname.
• If the first name does not have 4 characters, more characters are taken from the surname to
make up the user name.
• If the total number of characters in the first name and the surname is less than 5 then append
sufficient number of 0s to create the username.
An initial password is generated by combining randomly selected 5 characters from the full
name of the user.
Note than no spaces are allowed in the username or password.
User input should be obtained using a QInputDialog. You can expect the full name as a
single string where each word is separated using a space. For example: Mike William
Owen. The output (username and password) should be displayed using a QMessageBox.
You need not do any verification of the user input. You can assume that the user will enter at
least two words in the QInputDialog. Assume that the first word of the input is the first name
and the last word in the name is the surname - for example, for the sample input Mike
William Owen, Mike should be read as the first name and Owen as the surname and the
generated username should be mikeo.

I only managed to do the below:
I would appreciate any help.

<code>

#include <QApplication>
#include <QInputDialog>
#include <QMessageBox>
#include <QString>
#include <QTextStream>

QTextStream cout(stdout);
QTextStream cin(stdin);

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QString userFull, user1, user2;

userFull = QInputDialog::getText(0,"Please enter your full name: ", "User Name");




QMessageBox::information(0,"username: ", userFull);

//user1 = userFull.length();

//QString userinput = QInputDialog::getText(0,"Please enter your lastname: ", "User Name");
//getline(cin, user2);

//if(user1.size() < 3)

//for(int i = 0; i < user1; i++)
// getline(cin, user1.size(3));

// user1 = userName.size(3);

return a.exec();
}

</code>