473,406 Members | 2,549 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,406 software developers and data experts.

Help Needed for Computer Science Class

I need to write a program which performs word subsitutions on a text
file. The program should input the names of three text files: the
source file that will be "edited", a text file that contains the
editing instructions, and a file that will contain the result of the
editing.

Nov 3 '05 #1
2 1753
<Pa********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I need to write a program
So write it.
which performs word subsitutions on a text
file.
You seem to know what it should do.
The program should input the names of three text files: the
source file that will be "edited", a text file that contains the
editing instructions, and a file that will contain the result of the
editing.


And some details.

You asked for 'help'. Help with what? I don't see any code.
You didn't expect anyone to write it for you, did you?

Were I given that assignment worded as you've posted it,
I'd ask for a few more details, espeically what should
be the possible editing instructions, in what format,
etc.

We're waiting and ready to help as soon as we see your code
and some specific questions.
-Mike
Nov 3 '05 #2
Hi Dude,
The program should input the names of three text files: the
source file that will be "edited", a text file that contains the
editing instructions, and a file that will contain the result of the
editing.
this requires use of program arguments. The signature of your program
is

int main(int argc, char** argv)

check out how to use them but in a nutshell argv[0] returns the name of
your executable and argv[1] refers to the first command line argument.
You can check the number of arguments by looking at argc's value.
You'll also need someway of reading the input file into some sort of
buffer or perhaps reading the file line by line or word by word or even
letter by letter (you've to decide) and performing a manilpulation that
way. I'd say std::string's will be very helpful to you and perhaps
ostringstreams for the output file. Again, I'm not sure. Mark's pointed
out that you'll need to get detailed specifics on what youre supposed
to do/implement. If you are tied-up waiting for that, you should
probably start by at least reading argv etc. and perhaps opening your
files in the appropriate modes. Just an idea.

The program should input the names of three text files: the
source file that will be "edited", a text file that contains the
editing instructions, and a file that will contain the result of the
editing.

OK, what your lecturer is after here is (among other things) evidence
that you know how to open files in different modes. There's a whole lot
you can read up on, but you should maybe look first to see which files
are to be opened readonly, read-write, which are to be created if they
don't already exist etc. etc. You'll have to decide what files are
opened in what mode and then go ahead and code.
Dunno how much coding you've done but you're lecturer is going to look
for evidence of understanding of the calls you make, error
checking/exceptions and good overall design.
If you start to make progress and get stuck, this group is great for
pointing out errors etc. The trick is to show them you've already tried
a stab at it at the very least.

good luck. Go for an A+ in this project... when is it due?

GrahamO

Mike Wahler wrote: <Pa********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I need to write a program


So write it.
which performs word subsitutions on a text
file.


You seem to know what it should do.
The program should input the names of three text files: the
source file that will be "edited", a text file that contains the
editing instructions, and a file that will contain the result of the
editing.


And some details.

You asked for 'help'. Help with what? I don't see any code.
You didn't expect anyone to write it for you, did you?

Were I given that assignment worded as you've posted it,
I'd ask for a few more details, espeically what should
be the possible editing instructions, in what format,
etc.

We're waiting and ready to help as soon as we see your code
and some specific questions.
-Mike


Nov 3 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jack Smith | last post by:
Help needed on this question. Any help is appreciated. Thanks in advance. Given a binary string (i.e. a finite sequence of 0's and 1's) we choose any two digit substring 01 and replace it by a...
0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
8
by: Wolfgang Lipp | last post by:
<annotation> the first eleven contributions in this thread started as an off-list email discussion; i have posted them here with the consent of their authors. -- _w.lipp </annotation> From:...
2
by: Ian DeRock | last post by:
I'm fairly new to XML. As I can see it, XML is a way to organize data like in a table in a RDB, or the RDB itself. I have used XML in application data, but did not design the actual XML. I...
5
by: Dr. Ann Huxtable | last post by:
Hello All, I am reading a CSV (comma seperated value) file into a 2D array. I want to be able to sort multiple columns (ala Excel), so I know for starters, I cant be using the array, I need...
8
by: Bshealey786 | last post by:
Okay im doing my final project for my first computer science class(its my major, so it will be my first of many), but anyway im a beginner so im not to great with C++ yet. Anyway this is the error...
6
by: kwangbok.kim | last post by:
Hi. I'm major in computer science. While studying with the what kind of document, the problem got. Please help me. The lower part is the program... Programming with visual c++ 6.0 at windows xp...
2
by: varusnyc | last post by:
Hello, I just started learning strings and dont even know how to properly execute simple part of the program that splits phrase of two words with one space in between into 2 separate strings. I...
4
by: joder2006 | last post by:
So I'm working on this class and I have a major problem. This class happens to be for a rocket, it's a game that you play and you try to see it you can land safely from 1000 meters up in the...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.