Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 08:39 PM
Angela K
Guest
 
Posts: n/a
Default Whoever loves C++ and java programming, come here

I need to translate this code into java, can anyone do it?

#include <iostream.h>
#include "LinkedList.h"
#include "mystring.h"


template <class Object>

void printList(const List<Object> & theList) {

if(theList.isEmpty())

cout << "The List is Empty, Dude!!" << endl;

else {

ListItr<Object> itr = theList.first();

for( ; !itr.isPastEnd(); itr.advance())

cout << itr.retrieve() << " ";

} //printing list in else statement

cout << endl;

} // print list

int main() {

string x;

List<string> myList;

ListItr<string> theItr = myList.zeroth();

int i = 0;

printList(myList);


cout << "Enter string values, seperated by whitespace." << endl;

cout << "ctrl-d by itself on a line will terminate the process." << endl;

cout << "Watch the List Building Up in Progress!!" << endl;

while (cin >> x) {

myList.insert(x, theItr);

printList(myList);

theItr.advance();

i++;

}

cout << endl;

cout << "Traverse the Entire List.Remove the names(nodes) that begin with

the character" << endl;

cout << "\"a\"" << endl;

cout << "Watch the List Shrinkage in Progress!!" << endl;

cout << endl;



string y;

string a = "a";



ListItr<string> tItr = myList.first();

for( ; !tItr.isPastEnd(); tItr.advance()) {

y = tItr.retrieve();

if(y[0] == a[0]) {

myList.remove(y);

printList(myList);

}

}
return 0;

} //main





  #2  
Old July 19th, 2005, 08:39 PM
Moonlit
Guest
 
Posts: n/a
Default Re: Whoever loves C++ and java programming, come here

Hi,

"Angela K" <crxgurl@shaw.ca> wrote in message
news:Y6Amb.178112$pl3.106284@pd7tw3no...[color=blue]
> I need to translate this code into java, can anyone do it?
>[/color]

No!

Java (like C#) is just another C++ clone without the good stuff.

Never understand why they didn't just use C++ to create applets.

However with a lot more typing every C++ program can be turned into a java
program.

Use java containers instead of C++ templates, have a look at the
documentation at http://www.javasoft.com

This newsgroup is about the C++ language maybe you should ask this question
in a java oriented group.

Regards, Ron AF Greve.


[color=blue]
> #include <iostream.h>
> #include "LinkedList.h"
> #include "mystring.h"
>
>
> template <class Object>
>
> void printList(const List<Object> & theList) {
>
> if(theList.isEmpty())
>
> cout << "The List is Empty, Dude!!" << endl;
>
> else {
>
> ListItr<Object> itr = theList.first();
>
> for( ; !itr.isPastEnd(); itr.advance())
>
> cout << itr.retrieve() << " ";
>
> } //printing list in else statement
>
> cout << endl;
>
> } // print list
>
> int main() {
>
> string x;
>
> List<string> myList;
>
> ListItr<string> theItr = myList.zeroth();
>
> int i = 0;
>
> printList(myList);
>
>
> cout << "Enter string values, seperated by whitespace." << endl;
>
> cout << "ctrl-d by itself on a line will terminate the process." <<[/color]
endl;[color=blue]
>
> cout << "Watch the List Building Up in Progress!!" << endl;
>
> while (cin >> x) {
>
> myList.insert(x, theItr);
>
> printList(myList);
>
> theItr.advance();
>
> i++;
>
> }
>
> cout << endl;
>
> cout << "Traverse the Entire List.Remove the names(nodes) that begin[/color]
with[color=blue]
>
> the character" << endl;
>
> cout << "\"a\"" << endl;
>
> cout << "Watch the List Shrinkage in Progress!!" << endl;
>
> cout << endl;
>
>
>
> string y;
>
> string a = "a";
>
>
>
> ListItr<string> tItr = myList.first();
>
> for( ; !tItr.isPastEnd(); tItr.advance()) {
>
> y = tItr.retrieve();
>
> if(y[0] == a[0]) {
>
> myList.remove(y);
>
> printList(myList);
>
> }
>
> }
> return 0;
>
> } //main
>
>
>
>
>[/color]


  #3  
Old July 19th, 2005, 08:39 PM
Gregg
Guest
 
Posts: n/a
Default [OT] Re: Whoever loves C++ and java programming, come here

"Moonlit" <alt.spam@jupiter.universe> wrote in
news:3f9ad4ad$0$58707$e4fe514c@news.xs4all.nl:
[color=blue]
> Hi,
>
> "Angela K" <crxgurl@shaw.ca> wrote in message
> news:Y6Amb.178112$pl3.106284@pd7tw3no...[color=green]
>> I need to translate this code into java, can anyone do it?
>>[/color]
>
> No!
>
> Java (like C#) is just another C++ clone without the good stuff.
>[/color]

No, they are not clones of C++. They are very different languages with
different design goals that have only superficial (mainly syntactic)
similarities to C++. You might have an argument that C# is a clone of
Java, though.
[color=blue]
> Never understand why they didn't just use C++ to create applets.
>[/color]

It's been done. That's what ActiveX usually is.

Gregg

  #4  
Old July 19th, 2005, 08:39 PM
Julián Albo
Guest
 
Posts: n/a
Default Re: Whoever loves C++ and java programming, come here

Angela K escribió:
[color=blue]
> I need to translate this code into java, can anyone do it?[/color]

How much do you pay for?

Regards.
  #5  
Old July 19th, 2005, 08:39 PM
DvDmanDT
Guest
 
Posts: n/a
Default Re: [OT] Re: Whoever loves C++ and java programming, come here

Not C++, but C... Not clones, but members of 'the C family'...
"Gregg" <gregg@invalid.invalid> skrev i meddelandet
news:Xns941FA3C2F5940gregginvalidinvalid@207.69.15 4.206...[color=blue]
> "Moonlit" <alt.spam@jupiter.universe> wrote in
> news:3f9ad4ad$0$58707$e4fe514c@news.xs4all.nl:
>[color=green]
> > Hi,
> >
> > "Angela K" <crxgurl@shaw.ca> wrote in message
> > news:Y6Amb.178112$pl3.106284@pd7tw3no...[color=darkred]
> >> I need to translate this code into java, can anyone do it?
> >>[/color]
> >
> > No!
> >
> > Java (like C#) is just another C++ clone without the good stuff.
> >[/color]
>
> No, they are not clones of C++. They are very different languages with
> different design goals that have only superficial (mainly syntactic)
> similarities to C++. You might have an argument that C# is a clone of
> Java, though.
>[color=green]
> > Never understand why they didn't just use C++ to create applets.
> >[/color]
>
> It's been done. That's what ActiveX usually is.
>
> Gregg
>[/color]


  #6  
Old July 19th, 2005, 08:39 PM
Moonlit
Guest
 
Posts: n/a
Default Re: [OT] Re: Whoever loves C++ and java programming, come here


"Gregg" <gregg@invalid.invalid> wrote in message
news:Xns941FA3C2F5940gregginvalidinvalid@207.69.15 4.206...[color=blue]
> "Moonlit" <alt.spam@jupiter.universe> wrote in
> news:3f9ad4ad$0$58707$e4fe514c@news.xs4all.nl:
>[color=green]
> > Hi,
> >
> > "Angela K" <crxgurl@shaw.ca> wrote in message
> > news:Y6Amb.178112$pl3.106284@pd7tw3no...[color=darkred]
> >> I need to translate this code into java, can anyone do it?
> >>[/color]
> >
> > No!
> >
> > Java (like C#) is just another C++ clone without the good stuff.
> >[/color]
>[/color]
Considering the syntax I think of it as a clone of C++. It is also very easy
to learn if you already know C++. This is not a language they come up with
without looking at C++.
[color=blue]
> No, they are not clones of C++. They are very different languages with
> different design goals that have only superficial (mainly syntactic)
> similarities to C++. You might have an argument that C# is a clone of
> Java, though.
>[color=green]
> > Never understand why they didn't just use C++ to create applets.
> >[/color]
>
> It's been done. That's what ActiveX usually is.[/color]

No, ActiveX only runs in IE. At the moment it is not as widely accepted as
Java.
[color=blue]
>
> Gregg
>[/color]

Regards, Ron AF Greve.


  #7  
Old July 19th, 2005, 08:39 PM
Gregg
Guest
 
Posts: n/a
Default Re: [OT] Re: Whoever loves C++ and java programming, come here

"Moonlit" <alt.spam@jupiter.universe> wrote in
news:3f9b1ee0$0$58708$e4fe514c@news.xs4all.nl:
[color=blue]
>
> "Gregg" <gregg@invalid.invalid> wrote in message
> news:Xns941FA3C2F5940gregginvalidinvalid@207.69.15 4.206...[/color]

[...]
[color=blue][color=green]
>>[color=darkred]
>> > Never understand why they didn't just use C++ to create applets.
>> >[/color]
>>
>> It's been done. That's what ActiveX usually is.[/color]
>
> No, ActiveX only runs in IE. At the moment it is not as widely
> accepted as Java.
>[color=green]
>>
>> Gregg
>>[/color]
>
> Regards, Ron AF Greve.
>[/color]

Not "no". I meant exactly what I wrote, that it has been done. I said
nothing about how universal or widely accepted it is.

Gregg
  #8  
Old July 19th, 2005, 08:40 PM
Mad Hamish
Guest
 
Posts: n/a
Default Re: [OT] Re: Whoever loves C++ and java programming, come here

On Sun, 26 Oct 2003 02:09:54 +0100, "Moonlit"
<alt.spam@jupiter.universe> wrote:
[color=blue]
>
>"Gregg" <gregg@invalid.invalid> wrote in message
>news:Xns941FA3C2F5940gregginvalidinvalid@207.69.1 54.206...[color=green]
>> "Moonlit" <alt.spam@jupiter.universe> wrote in
>> news:3f9ad4ad$0$58707$e4fe514c@news.xs4all.nl:
>>[color=darkred]
>> > Hi,
>> >
>> > "Angela K" <crxgurl@shaw.ca> wrote in message
>> > news:Y6Amb.178112$pl3.106284@pd7tw3no...
>> >> I need to translate this code into java, can anyone do it?
>> >>
>> >
>> > No!
>> >
>> > Java (like C#) is just another C++ clone without the good stuff.
>> >[/color]
>>[/color]
>Considering the syntax I think of it as a clone of C++. It is also very easy
>to learn if you already know C++. This is not a language they come up with
>without looking at C++.
>[/color]

Much of the syntactic similarities between Java and C++ predate C by a
fair while.
--
"Hope is replaced by fear and dreams by survival, most of us get by."
Stuart Adamson 1958-2001

Mad Hamish
Hamish Laws
h_laws@aardvark.net.au
 

Bookmarks

Thread Tools

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles