Results 1 to 7 of 7
Hello! I'm new to this forum.
I really suck at C/C++ and I was wondering if anyone can help me with two programs.
1)
Write a program in C, which ...
- 11-26-2008 #1Just Joined!
- Join Date
- Nov 2008
- Posts
- 3
Help with a program in C.
Hello! I'm new to this forum.
I really suck at C/C++ and I was wondering if anyone can help me with two programs.
1)
Write a program in C, which will create a child. The father and the child will communicate through pipes. The father will read words from the user, which he will then send to the child. The child will calculate the number of letters the word has and return that number to the father.
When the user inputs the word "END", the child will terminate and the father will print the total number of letters from all the words given and then terminate.
2)
Write a program in C, which will create a child. The father and the child will communicate through pipes. The child will read letters from the user and send them to the father. The father will take those letters and turn them to lowercase if they are uppercase and the opposite and send the altered letter back to the child, which will print it. The two processes will finish if the user inputs the letters "Q" or "q".
If somebody can help me with those 2 programs, I'd be indebted to them. Also, if possible, write a comment next to each command so I can understand what it does. The point is for me to understand the programs.
Thank you, and I'll be waiting.
- 11-26-2008 #2
You want us to do your homework???
- 11-26-2008 #3Just Joined!
- Join Date
- Nov 2008
- Posts
- 3
It may seem that way to you, but I want to understand the programs. That's why I'm asking for comments next to the commands. Although I know some C, I'm lost when it comes to forks, pipes and threads.
Besides, an expert in C can write those programs in like 5 minutes. So I don't think it's a big deal.
- 11-26-2008 #4
What Gerard said.
We don't do homework for you, of course, and most of those of us who answer questions do so on the basis of "leverage"; a few minutes of our time will do you a world of good. That happens when you do these things:
- Read the documentation. In this case, read the man pages, as follows:
Code:man pipe man socketpair man popen man fork
- Then, for each of those man pages, look at the end at the SEE ALSO section. Read each referenced man page. For some of those referenced man pages, you may only have to read far enough to realize that you don't need that man page.
- If you have any specific questions about what's in one of the man pages, come back and ask.
- Then write your code.
- If it doesn't work, gather exact error messages and exact other bad behavior, and post those things with your question. What would help would be to post the source code for a tiny program which illustrates the problem.
Hope this helps.--
Bill
Old age and treachery will overcome youth and skill.
- Read the documentation. In this case, read the man pages, as follows:
- 11-26-2008 #5So hire someone. Pay him by the hour. It ought to cost you, oh, ten bucks if you're right.an expert in C can write those programs in like 5 minutes.--
Bill
Old age and treachery will overcome youth and skill.
- 11-26-2008 #6Just Joined!
- Join Date
- Nov 2008
- Posts
- 3
I think you've misunderstood me. I don't even study Computer Science. I'm an amateur. So the term "homework" doesn't quite apply.
Anyway, thanks for your help. I'll read the manual files, although I don't know how much it will help me.
- 11-26-2008 #7If something in them doesn't make sense, come back and ask.I'll read the manual files, although I don't know how much it will help me.
There's your problem. :) scroogle the following:I really suck at C/C++
You'll find several, one of which ought to be a good fit for you. This will help that old leverage concept.Code:C tutorial
--
Bill
Old age and treachery will overcome youth and skill.


Reply With Quote