473,513 Members | 6,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Jul 19 '05 #1
7 1829
Hi,

"Angela K" <cr*****@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.

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.
#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


Jul 19 '05 #2
"Moonlit" <al******@jupiter.universe> wrote in
news:3f***********************@news.xs4all.nl:
Hi,

"Angela K" <cr*****@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.


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.
Never understand why they didn't just use C++ to create applets.


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

Gregg

Jul 19 '05 #3
Angela K escribió:
I need to translate this code into java, can anyone do it?


How much do you pay for?

Regards.
Jul 19 '05 #4
Not C++, but C... Not clones, but members of 'the C family'...
"Gregg" <gr***@invalid.invalid> skrev i meddelandet
news:Xn*********************************@207.69.15 4.206...
"Moonlit" <al******@jupiter.universe> wrote in
news:3f***********************@news.xs4all.nl:
Hi,

"Angela K" <cr*****@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.


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.
Never understand why they didn't just use C++ to create applets.


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

Gregg

Jul 19 '05 #5

"Gregg" <gr***@invalid.invalid> wrote in message
news:Xn*********************************@207.69.15 4.206...
"Moonlit" <al******@jupiter.universe> wrote in
news:3f***********************@news.xs4all.nl:
Hi,

"Angela K" <cr*****@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.

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++.
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.
Never understand why they didn't just use C++ to create applets.

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


No, ActiveX only runs in IE. At the moment it is not as widely accepted as
Java.

Gregg


Regards, Ron AF Greve.
Jul 19 '05 #6
"Moonlit" <al******@jupiter.universe> wrote in
news:3f***********************@news.xs4all.nl:

"Gregg" <gr***@invalid.invalid> wrote in message
news:Xn*********************************@207.69.15 4.206...


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


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


No, ActiveX only runs in IE. At the moment it is not as widely
accepted as Java.

Gregg


Regards, Ron AF Greve.


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
Jul 19 '05 #7
On Sun, 26 Oct 2003 02:09:54 +0100, "Moonlit"
<al******@jupiter.universe> wrote:

"Gregg" <gr***@invalid.invalid> wrote in message
news:Xn*********************************@207.69.1 54.206...
"Moonlit" <al******@jupiter.universe> wrote in
news:3f***********************@news.xs4all.nl:
> Hi,
>
> "Angela K" <cr*****@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.
>

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++.


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_****@aardvark.net.au
Jul 19 '05 #8

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

Similar topics

5
2022
by: Angela K | last post by:
I need to translate this code into java, can anyone do it? #include <iostream.h> #include "LinkedList.h" #include "mystring.h"
198
18090
by: Michael N. Christoff | last post by:
Java, the software developed by Sun Microsystems in the mid-1990s as a universal operating system for Internet applications, gave NASA a low-cost and easy-to-use option for running Spirit, the...
11
9213
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
133
8425
by: Gaurav | last post by:
http://www.sys-con.com/story/print.cfm?storyid=45250 Any comments? Thanks Gaurav
5
2298
by: TZESENG | last post by:
DECEMBER 13, 2005 . Editions: N. America | Europe | Asia | Edition Preference News Analysis By Steve Hamm Source: http://www.businessweek.com/technology/content/dec2005/tc20051213_042973.htm...
1
9587
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
2
6927
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
5
6259
by: r035198x | last post by:
Setting up. Getting started To get started with java, one must download and install a version of Sun's JDK (Java Development Kit). The newest release at the time of writting this article is...
0
3877
by: r035198x | last post by:
Inheritance We have already covered one important concept of object-oriented programming, namely encapsulation, in the previous article. These articles are not articles on object oriented...
0
7254
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
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7373
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,...
1
7094
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
5677
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,...
1
5079
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...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1585
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 ...

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.