473,396 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

The project programming problem, please help seriously>.<

Our college changes 18 weeks semester to 16 semester, so our CS professor cannot finish teaching the last important chapter which is related with my problw\em.

This is program C problem

Anyone can help me with this problem, please!!!!!!!!!
This is the problem:
3. Several input text files have been provided as input to your program.
a) Write a function to combine these files into a single file.
b) Write a function to take care of multiple spaces and replace each occurrence of a multiple spaces with a single space.
c) Write a function to examine the words in your text file and count the number of words. Words are separated by white spaces i.e. space, newlines or tabs.
d) Write a function to count the word length in the file. Do not count punctuation characters when determining word length. Report on the screen the shortest and longest words.
Test all the above functions. Try it first by using your own text files" Myfile1" and" Myfile2" (write two short text files, about ten words each). Then use the data posted http://www.mtsac.edu/rvhpop/proj4-110.txt
the hint is that it is similar to this code:

#include <stdio.h>

main()
{
FILE
*inptr, *outptr;
int
c,empno;
float
pay;
char
empname[20];
/************************************************** **************/
/* open the input and the temporary files, with error checking */
/************************************************** **************/
inptr = fopen("payrates", "r");
if (inptr == NULL)
{
printf("Problem opening file \"payrates\" \n");
exit(1);
}
outptr = fopen("tempfile","w");
if (outptr == NULL)
{
printf("Problem opening output file...\n");
exit(1);
}
/************************************************** **************/
/* read the file, update the pay field, write to the temp file */
/************************************************** **************/

c = fscanf(inptr,"%d %s %f",&empno, empname, &pay);
while (c != EOF)
{
pay = pay*1.05;
fprintf(outptr,"%4d %20s %6.2f\n",empno,empname,pay);
c = fscanf(inptr,"%d %s %f",&empno, empname, &pay);
}
/************************************************** **************/
/* make sure you close the files, otherwise remove and rename */
/* will not work correctly. */
/************************************************** **************/
fclose(inptr);
fclose(outptr);
/************************************************** **************/
/* remove the old "payrates" file, rename "tempfile" "payrates" */
/* note the error checking. */
/************************************************** **************/
/* USE remove ON THE MAC SYSTEMS, unlink ON UNIX */
/*if((remove("payrates")) == -1) */
if((unlink("payrates")) == -1)
{
printf("remove didn't work...\n");
}
if((rename("tempfile","payrates")) != 0)
{
printf("rename error...\n");
}
}

Pleas help
My email: nt91rx78@hotmail.com
Dec 2 '06 #1
0 1451

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: trdonavan | last post by:
Several things may have happened since I last successfully debugged this project. Something has caused it to fail to debug giving the message: Parser Error Message: Could not load type...
11
by: Wolfgang Kaml | last post by:
I am not sure if this is more of an expert question, but I am sure that they are out there. I'd like to setup a general application or bin directory on my Win2003.Net Server that will hold some...
5
by: Jay A. Moritz | last post by:
Error: The dependency '<my dll>' in project '<my project>' cannot be copied to the run directory because it would conflict with dependency '<my dll>'. I am getting a dependency error building...
3
by: noreponse1 | last post by:
Hello, I have a solution that contains two projects. I have 2 dlls that these projects use. Here's how it's set up: Solution -ProjectA --References ---DLLA -ProjectB
6
by: Just D. | last post by:
Does anybody know if there any open source project written in C# as a class library allowing to convert RTF string into HTML string? I'd like to join this project for the interest of both sides. I...
4
by: aze | last post by:
Hi, I have a 2 c files (pdfp.c, PrinterUtils.c) and 1 .h file (PrinterUtils.h) and 1 .mak file (pdfp.mak). What I need to do is compile these files into a dll so I can use them in my asp.net...
1
by: Steve JORDI | last post by:
Hi, it seems to me that I have a problem using an LDAPS connection to our server for identification purposes (using OpenLDAP and OpenSSL). Using PHP 4.4.4 I have the following code which...
3
by: DonJefe | last post by:
Does anyone have experience using project->project references in large solutions? What are the plus/minuses that you have found? Currently, we are using the binary assembly references for our...
2
by: Keita | last post by:
Hi everyone. I'm using a socket-based application (written in C++) for Windows platforms. Everything works fine when trying to connect in Administrator mode, but when in User mode no communication...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.