473,748 Members | 3,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1785
<Pa********@gma il.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.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********@gma il.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.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
2675
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 string of the form 100...0 using an arbitrary (but finite) number of zeros. Prove by induction that this transformation can not be performed infinitely many times, i.e. this sequence of transformations must terminate for any input string.
0
3465
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 Pentagjetvedeh karuvificials madhla reachathe strategy in karkun campaign deshatinst terrorism. "mudivae maretu winning or losing karkun global varti jetvedeh terror?" Mr. Rumsfeld adugued in a recent memormariyuum. vede velli jetvedeh madhla...
8
3152
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: Eric van der Vlist Sent: Tuesday, 27?January?2004 13:53 Hi,
2
3538
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 have a background in both hardware and software. I want to create an application that will regenerate a resume from the XML Resume that I have. I would like some people to look over my XML Resume data and give me suggestions on the XML. This...
5
8982
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 something more sophistictated like a vector of row objects. The data is of this format (same number of columns for each row): A, x, y, z, ...
8
2009
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 msg that im getting: "Error executing cl.exe" this is the code that I have, but I know whats causing it, ill just show you the whole thing first though //file: Quadratic
6
1459
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 -------------------------------------------------------------------------------------------- #include <iostream.h> #include <string.h>
2
1434
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 realize that substr() need to be used, but words may varie in length so I have to make it initialize first string any length before first space and second string after the space. For example: "computer science" into first string "computer" second...
4
1875
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 air. The problem is when I input the throttle the program ignores it. It doesn't matter what i input into the throttle i get the same result. There are also other problems as well.
0
9372
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9324
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.