Hi

I'm only new to C++ and need urgent help with an assignment that's due tomorrow. I know this is frowned upon but I'm really stuck and don't know what to do.

Can someone please point me in the right direction with this question?

(A) Read the first name and the surname of a person.
Calculate n1 = the integer representing the first letter (counting
from the left) of the first name in the ASCII table.
For example, if the first name is “James”, then n1=74 (i.e. the value representing ‘J’ is
74 in the ASCII table).
Note that there is no restriction that the first letter entered must be a capital letter.
(B) Calculate n2 = the integer representing the first letter of the
surname in the ASCII table.
For example, if the surname is “Bond”, then n2 = 66 (i.e. the value representing ‘B’ is
66 in the ASCII table).
(C) Calculate and display n3 = the squared digit length of n1.
The following process determines the squared digit length of an integer. Take any
integer and add up the squares of its digits. This will give you another integer. Repeat
this procedure until the number you end up with is 1 or 4. The number of times this
process has to be repeated before it gets to 1 or 4 is the squared digit length. For
example, if we start with 85, we get:
82 + 52 = 89
82 + 92 = 145
12 + 42 + 52 = 42
42 + 22 = 20
22 + 02 = 4
This process shows that the squared digit length of 85 is 5.
According to the experts, this process will always eventually reach either 1 or 4. The
squared digit length of 1 and 4 is zero, since we don't actually have to apply the
process to them to reach the stopping condition (interestingly, though, if we did apply
the process, to 1, we would keep getting 1, but if we applied it to 4, we would get a
repeating sequence: 4, 16, 37, 58, 89, 145, 42, 20, 4).
(D) Calculate and display n4 = the squared digit length of n2.
(E) Calculate and display n5 = the largest prime factor of n3+n4.
A prime factor of integer n is a factor of n which is a prime number. A prime number
is any integer greater than 1 and only divisible by itself and 1 (e.g. 2, 3, 5, 7, 11, 13,
17 etc). For example, 3 is the largest prime factor of 27 and 7 is the largest prime
factor of 49.

>>I'm only new to C++ and need urgent help with an assignment that's due tomorrow.
Procrastinating did you :) You can not leave programming assignments until the last minute, if you do you will fail the course. Programming takes lots and lots of time and effort.

Do the program one small piece at a time. Get the first part working then go on to do the next part. For example, your first task is to write a program to get the last name and sir name from keyboard. Use cout to display prompts and cin to get user keyboard input. You will need two strings, one for sirname and the other for lastname.

commented: Very good reply :) !! +3
std::string firstname;
cout << "Enter first name " << endl;
cin >> firstname ;

Just to get you started with your homework.

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.