Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 12-20-2004, 11:07 AM   #1 (permalink)
VaMpIrE
banned
 
Join Date: Dec 2004
Posts: 4
VaMpIrE is on a distinguished road
Can anyone help me in this assignment plZ?

Hello everyone,,

Can anyone help me with this program please??

----------------------------------------------------------------------

This assignment requires you to write a simple text editor. Your editor will have the following commands:

e filename edits the filename if it exists
If it doesn’t exist, then you’ll be creating a new file.

i (insert mode) insert any number of lines after current line.
Ctrl- v stop inserting data (turn off insert mode)
l list the entire file without line numbers
n list the entire file with line numbers
d n delete the number n
c count the numbr of lines in the file
s save the file opened with the e command
p print the file
q quit the program prompting for save if the file has not been saved


Once your program begins, a prompt must appear on the screen. Commands can be entered following the prompt. A sample run of program is shown below:

> e welcome.cpp
> i
#include <iostream>
using namespace std;
void main ()
{
cout<<”Welcome to Etisalat College”<<endl;
}
^V
1) #include <iostream>
2) using namespace std;
3) void main ()
4) {
5) cout<<”Welcome to Etisalat College”<<endl;
6) }

> c
welcome.cpp has 6 lines
> s
saved welcome.cpp
> p
printing welcome.cpp
> q

================================================== =======

This is the program:

Code:
#include<iostream>
#include<fstream>
using namespace std;

int main ()
{
char letter;
ofstream printer (“USB001”, ios::out);ccout<<”+++++++Welcome to this editor program++++++++”<<endl;
cout<<”i: insert mode” <<endl;
cout<<””ctrl-v: turn off insert mode”<<endl;
cout<<”l: list the entire file without line numbers”<<endl;
cout<<”n: list the entire file with line numbers”<<endl;
cout<<”d n”: delete line number n”<<endl;
cout<<”c: count the number of lines in the file”<<endl;
cout<<”s: save the file opened with the e command”<<endl;
cout<<”q: quit the program prompting for save if the file has not been saved”<<endl;

cout<< ”<<”;
cin>>letter;

while (letter != ‘q’)
{
ifstream infile (“sample.txt”, ios::in);
switch (letter)
{
case ‘p’:
char a;

while (infile.get(a))
printer<<a;
cout<<”Printing”<<infile<<endl;
cout<< “<<”;
cin>>letter;
break;




case  ‘s’:

cout<<”Your file is being saved”<<endl;
cout<< “<<”;
cin>>letter;
break;

case ‘n’ ; 

int count;
count=1;
char c;
start:
cout<<count << “)”;
while (infile.get(c ) )         
{
cout<<c;
if (c= = ‘\n’)
{
++count;
goto start;
}}
cout<<endl<< “<”;
cin>>letter;
break;

case ‘c’;
int counter;
counter= 1;
char d;
while (infile.get(d))
{
if (d= =’\n’)
{
++counter;
}}
if ( counter! =1)
cout<<”Sample.txt has “<<counter<<”lines”;
else if ((counter= =1) && (d= =’\0’))
cout<<”the file sample.txt contains no lines”;
else
cout<<”the file contains only 1 line”;
cout<<endl<< “<”;
cin>>letter;
break;

case’i’:

char in;
while (infile.get(in))
cout<<endl<< “<”;
cin>>letter;
break;

case”l”:

while (infile.get(in))
cout<<in;
cout<<endl<< “<”;
cin>>letter;
break;

default:
cout<<”invalid choice”<<endl;
cout<< ”<”;
cin>>letter;
break;
}}

return 0;
}

================================================== ======
Can anyone tell me how to do the "ctrl-v" and "delete" ???
and is there any other method other than using switch and cases??


ThanX ver much indeed

Last edited by Valmont; 12-21-2004 at 10:42 AM.
VaMpIrE is offline  
Old 12-20-2004, 11:28 AM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,545
Valmont is on a distinguished road
Quote:
Ctrl- v stop inserting data (turn off insert mode)
The ISO C++ standard does not know what this is. The standard doesn't know what a key is, the standard even doesn't know what a keyboard is. The standard even never heard of any device. I suspect you need to be more clear on this.

Quote:
n list the entire file with line numbers
d n delete the number n
Be more correct.

And finally use the [ code ] tags.
__________________
Valmont is offline  
Old 12-21-2004, 06:54 AM   #3 (permalink)
VaMpIrE
banned
 
Join Date: Dec 2004
Posts: 4
VaMpIrE is on a distinguished road
Quote:
Originally Posted by Valmont
The ISO C++ standard does not know what this is. The standard doesn't know what a key is, the standard even doesn't know what a keyboard is. The standard even never heard of any device. I suspect you need to be more clear on this.


Be more correct.

And finally use the [ code ] tags.




Holaaaa again ,,,,,,


MuahahahahahahahahaZ

maaaaaaaaaaan, You know nothing about programming or computer languages

Wahahahahahaha, You don't understand what these code means !!

Oh boy!!!

And above that you say that you're a programmer, and a super moderator in this forum


maaaaaaan, you're just a #%$#$#%#%##%#$#$#%#%$#.....toot toot toot



:th: Adiooooooooooooos :th:
VaMpIrE is offline  
Old 12-21-2004, 08:21 AM   #4 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,694
redhead is on a distinguished road
Quote:
Originally Posted by VaMpIrE
Holaaaa again ,,,,,,
MuahahahahahahahahaZ
maaaaaaaaaaan, You know nothing about programming or computer languages
Wahahahahahaha, You don't understand what these code means !!

Oh boy!!!
Valmont knows about these commands, but they are OS dependent, nothing within the ANSI standard tells anything about them.
On some systems <ctrl>+v is end transmission, on other systems the correct one is <ctrl>+d on yet others it's <ctrl>+z so there is no uniq way of searching for this EOS (end of stream)
Since Valmont, as many otheres here, swear to folow the ANSI standard these terminating codes aren't uniq enough in order to tell how to end the read from a users input.
Quote:
Originally Posted by VaMpIrE
And above that you say that you're a programmer, and a super moderator in this forum
Valmont knows way more about programming within the C++ language, than any one you'd meet in the following year, and one sure way of setting a negative vibe about your person, is trying to piss off a moderator.
Quote:
Originally Posted by VaMpIrE
maaaaaaan, you're just a #%$#$#%#%##%#$#$#%#%$#.....toot toot toot

:th: Adiooooooooooooos :th:
Well, here is the real deal, one person points out a few things, the next thing you know, you get offended and start insulting that person....
Lets keep things clean here, there is no reason to mock people. I support Valmont in his points here, if I didn't, I would have provided an answer telling you how to do it, when I first saw Valmonts post.
But since you're beginning with that tone I won't even considder finding a solution for you..
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline  
Old 12-21-2004, 10:50 AM   #5 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,545
Valmont is on a distinguished road
Quote:
Originally Posted by VaMpIrE
Holaaaa again ,,,,,,


MuahahahahahahahahaZ

maaaaaaaaaaan, You know nothing about programming or computer languages

Wahahahahahaha, You don't understand what these code means !!

Oh boy!!!

And above that you say that you're a programmer, and a super moderator in this forum


maaaaaaan, you're just a #%$#$#%#%##%#$#$#%#%$#.....toot toot toot



:th: Adiooooooooooooos :th:
Whatever it is that you think I am, you are out of options here. Leave and don't come back.
Toot.
__________________
Valmont is offline  
Old 12-21-2004, 05:34 PM   #6 (permalink)
idx
Senior Grasshopper
 
idx's Avatar
 
Join Date: Jun 2003
Location: FL
Posts: 317
idx is on a distinguished road
Trolls will be trolls... and bored 12 year olds..

-r
idx is offline  
Old 12-22-2004, 03:57 AM   #7 (permalink)
VaMpIrE
banned
 
Join Date: Dec 2004
Posts: 4
VaMpIrE is on a distinguished road
Please boot my potty mouth out of here.
Thank you, have nice day.

Last edited by Valmont; 12-22-2004 at 06:24 AM.
VaMpIrE is offline  
Old 12-22-2004, 07:30 AM   #8 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,446
sde is on a distinguished road
the topic should have been "can anyone do my homework for me" .. i can't believe this guy can flame when he's too lazy to even start his homework on his own. what a loser.
__________________
Mike
sde is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help in my assignment plZ VaMpIrE Standard C, C++ 1 12-08-2004 01:15 AM
i have a quetion that needs answered plz... Termite HTML, XML, Javascript, AJAX 6 05-15-2004 09:28 PM
i have a child window which i want to print at the same time hiding plz help deepanakr HTML, XML, Javascript, AJAX 0 05-10-2004 10:08 PM
plz help panic-- Lounge 4 04-07-2003 06:21 AM
colo in L.A. area needed .. plz sde Lounge 1 12-21-2002 05:53 AM


All times are GMT -8. The time now is 05:07 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting