By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,558 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,558 IT Pros & Developers. It's quick & easy.

Whoever loves C++ and java programming, come here

P: n/a
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 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
There is a fortran to java translator so if you
convert your program to fortran it is a snap.
"Angela K" <cr*****@shaw.ca> wrote in message
news:W5Amb.177648$6C4.69738@pd7tw1no...
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 17 '05 #2

P: n/a
where would i find a C++ to fortran and a fortran to java convertor? I
searched google and couldnt find anything.

"Phil..." <ry***@ieee.org> wrote in message
news:tsAmb.25756$Fm2.12789@attbi_s04...
There is a fortran to java translator so if you
convert your program to fortran it is a snap.
"Angela K" <cr*****@shaw.ca> wrote in message
news:W5Amb.177648$6C4.69738@pd7tw1no...
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 17 '05 #3

P: n/a
I don't know about C++ to FORTRAN, but I may have
been too hasty about the FORTRAN to java. I found this site
http://netlib.bell-labs.com/netlib/java/index.html
that claims to have a directory of stuff for "FORTRAN to java" but
I just checked it out and it seems to be just stuff for the math library.
I believe they do have a translator, but I have not found it.

"Angela K" <cr*****@shaw.ca> wrote in message
news:gxBmb.178505$pl3.11349@pd7tw3no...
where would i find a C++ to fortran and a fortran to java convertor? I
searched google and couldnt find anything.

"Phil..." <ry***@ieee.org> wrote in message
news:tsAmb.25756$Fm2.12789@attbi_s04...
There is a fortran to java translator so if you
convert your program to fortran it is a snap.
"Angela K" <cr*****@shaw.ca> wrote in message
news:W5Amb.177648$6C4.69738@pd7tw1no...
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 17 '05 #4

P: n/a
Angela K wrote:
I need to translate this code into java, can anyone do it?


I'm sure lots of people here can. What is the job paying?

Brad BARCLAY

--
=-=-=-=-=-=-=-=-=
From the OS/2 WARP v4.5 Desktop of Brad BARCLAY.
The jSyncManager Project: http://www.jsyncmanager.org


Jul 17 '05 #5

P: n/a
Have you got a solution to this yet? It would be fairly simple Java
code, let me know if you still need it and I will email it to you.
"Angela K" <cr*****@shaw.ca> wrote in message news:<W5Amb.177648$6C4.69738@pd7tw1no>...
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 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.