I want to write a program where,

1. string1 is declared as char s1[80]. string2 is declared as s2[40]

2. Function 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".

Can someone point me toward a similar/example program that I can study & deconstruct, or any previously answered threads [if any] that deal with the situation described above?

Recommended Answers

All 4 Replies

Here's an idea: write your own code from scratch instead of being a helpless baby. You'll learn a lot more than you would by cheating your way to a solution. Besides, those instructions are just a few steps shy of being a line for line description of the program. Do you really need more detail?

Girl, get over yourself. You sit on message boards all day picking on people. How would looking at another example be cheating?

I'm not asking for answers. I'm not even getting graded & have nothing to cheat on. Things make more sense to me in context. If you don't like my posts, don't respond. I'm just going to ignore you from now on because I can't deal with your high and mighty bs.

If you don't like my posts, don't respond.

I responded because I wanted to help you instead of delete your post as it's a violation of our homework rule. Since you don't seem to appreciate the position you're in, I'll simply go by the book instead of trying to be nice.

You sit on message boards all day picking on people.

Incorrect.

How would looking at another example be cheating?

You realize that you're asking how being given the answer is cheating, right? It's clearly cheating because you're not doing the work, you're just sponging off of someone else's work. You don't learn nearly as much that way.

I'm not asking for answers.

Yes, you are. I wouldn't mind giving you answers, or helping improve your own answers if you bothered to make an honest attempt first.

I'm not even getting graded & have nothing to cheat on

So you're cheating yourself out of the learning experience and not even getting something tangible like a grade from it? That sounds incredibly stupid to me.

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.