I have been given, and need assistance with a problem that asks for a querying loop to continue until the user says "No". The program should concatenate two strings, check that the sum of the lengths are no more than 80 chars, and then print each queried string and the final appended string.
So, when does the user input no? At any point during runtime? What is the result? Program termination?
There is no concept called a queering loop. Could it be that the author intended to write a form of 'query' ?..
And wouldn't it be easier to just ask the friend ?
As for learning backwards, you think you do, but you don't. Just try writing something and we'll say what can be improved.
Ahh. See, that's what I thought... the program needs to prompt a person for a no.
1. string1 is declared as char s1[80]. string2 is declared as s2[40]
2. Functions needs to check that the sum of both strings is less than 80 characters prior to appending them
3. If the sum is greater than 80 characters, return a NULL
4. Function call should print the total length of concatenated string.
5. Input strings should be collected using fgets(&s1[0], len1 + 1, stdin) and fgets(&s2[0], len2 + 1, stdin)
given len1 and len2 are the max. size of the respective input strings.
6. Output should print both input strings and then the final appended string.
7. The querying loop should continue until the user says "No".
So, what is the purpose of querying for no? To terminate the program?
I don't think that is needed, though a random input allowing you to continue is a bit silly.
Don't worry much about the little things like this. Better concentrate on the algorithm itself..