527 Posted Topics

Member Avatar for nouryn

[QUOTE=nouryn;653055]I Used to be a c++ programmer and now i'm starting to learn java all by my self so i need a help in how to get starting begging with compiler and IDE tools and the basic diffrants between c++ and java Thanks[/QUOTE] Since you used to be a programmer, …

Member Avatar for nouryn
0
157
Member Avatar for supersoup
Member Avatar for QuantNeeds

I'm going to assume you have done tests in the following way-- [code=c++] #include <cstdlib> #include <iostream> using namespace std; struct Sort{ public: int arraySize; void swap(int&, int&); int partition(int[], int, int); void quickSort(int[], int, int); bool test(); }; void Sort::swap(int &value1, int &value2) { int temp = value1; value1 …

Member Avatar for Alex Edwards
0
70
Member Avatar for Da24K

> Write the definition of a method reverse , whose parameter is an array of integers. The method reverses the elements of the array. The method does not return a value > > So far I got: public void reverse(int[] backward) { for(int i = (backward.length -1); i >=0;i--){ } …

Member Avatar for bloody_ninja
0
682
Member Avatar for QuantNeeds

Get rid of the paranthesis around set-- [code=c++] bool Sort::test() { Sort set; bool answer = false; [/code]

Member Avatar for QuantNeeds
0
179
Member Avatar for LevelSix

Ok I saw some weird lines in your code. It looks like you declared inner classes within the scope of your methods. I'm really not sure how Java handles that. Typically any type that is declared within a method is destroyed unless it is a valid pointer. Then again I …

Member Avatar for Ezzaral
0
305
Member Avatar for shaynicb25

There are far, [I]far[/I] more errors to that code than just the illegal start of expression warning. Fist of all I can see a nested method declaration/definition which is illegal Secondly your System statements aren't capitalized in some areas. I can see many other errors such as the System.out.println printing …

Member Avatar for Alex Edwards
0
120
Member Avatar for TeCNoYoTTa

[QUOTE=TeCNoYoTTa;652137]thanks .....:D:D but i also want to know when to use it and what is it's uses[/QUOTE] A function that returns a valid reference can be treated as a lvalue. [code=c++] int& sumz(int x,int y) { int *sum = new int; *sum = x + y; return *sum; } [/code] …

Member Avatar for Alex Edwards
0
110
Member Avatar for JConnor135

You don't need to keep posting different topics about this. Since I'm not very helpful, I will for the last time point out the error then quit replying. [code=java] import java.util.*; public class IntNode { public int item; //element in list public IntNode next; //next node in list public IntNode …

Member Avatar for Alex Edwards
0
272
Member Avatar for JConnor135

[QUOTE=JConnor135;651927]For this code to delete an element from a linked list how do I get the head to point to the first element in the list(which is 0)? [ICODE]public class IntNode1 { public int item; public IntNode1 next; public IntNode1 head; //////Constructor/////// public IntNode1(int item1, IntNode1 next1) { next=next1; item=item1; …

Member Avatar for Alex Edwards
0
279
Member Avatar for aecsant

I think what you mean is you want a wrapper class-- [code=c++] #include <iostream> #include <cstdlib> class SubFoo{ }; class Foo{ private: SubFoo *sub; public: Foo(SubFoo &obj) : sub(&obj){} Foo(SubFoo *obj) : sub(obj){} }; int main(){ Foo foo = new SubFoo; SubFoo sb; Foo foo2 = sb; return 0; } …

Member Avatar for Prabakar
0
261
Member Avatar for shaynicb25

[code=java] import java.util.*; import java.text.NumberFormat; public class Election2 { public static void main(String[] args) { Scanner kb = new Scanner(System.in); // declaring/defining a Scanner object and giving it a handle to the standard input stream String[] names = new String [5]; // empty string array declaration/definition, stores 5 Strings short[] …

Member Avatar for Alex Edwards
0
2K
Member Avatar for JConnor135

Before I give you another suggestion for simply fixing one error, I'm curious to know what kind of Linked List you want to make? It looks like you want to make a doubly linked list, but I could be wrong. It also seems that you may, instead, be making a …

Member Avatar for JConnor135
0
273
Member Avatar for JConnor135

Beware of stale-data declarations! Here's the code revised, but I'm not sure if it will do exactly what you want. [code=java] import java.util.*; public class IntNode { public int item; public IntNode next; public IntNode head; IntNode prev = null; IntNode curr = head; //////Constructor/////// public IntNode(int item1, IntNode next1) …

Member Avatar for Alex Edwards
0
87
Member Avatar for Alex Edwards

How in the hell do you divide by 7 using nothing but-- ~, ^, >>, <<, &, | -- In a set algorithm. I'm stumped. I've tried mapping out different numbers dividing by each other... it didn't work. I would map out a number subtracting from the other to see …

Member Avatar for invisal
0
173
Member Avatar for Code Shark

I think this is what you meant-- [code=c++] // Code Shark #include <iostream> #include <windows.h> #include <string> using namespace std; int main() { srand(time(NULL)); unsigned int digit = 0, digit2 = 0, correct = 0, wrong = 0; string answer; do { system("Cls"); digit = rand() % 9 + 1; …

Member Avatar for VernonDozier
0
146
Member Avatar for sftwr21

[QUOTE=sftwr21;650065]Hello everyone, I'm learning programming for the first time and my first book i bought from the book store is the new Deitel C++ 6th edition. After reading the first several chapters I got so overwhelm with the authors verbose; I went out and bought C++Primer. One thing I noticed …

Member Avatar for Alex Edwards
0
398
Member Avatar for bloody_ninja

An I/O Exception is being thrown. You may find it useful to look up the Socket class in the java.net API [url]http://java.sun.com/javase/6/docs/api/java/net/Socket.html[/url] Here's a quote from the Socket constructor you're using-- [icode] Socket public Socket(String host, int port) throws UnknownHostException, IOException Creates a stream socket and connects it to the …

Member Avatar for masijade
0
299
Member Avatar for Dameon

[QUOTE=VernonDozier;648495]I imagine you want this line: [code] quarter = .25 number % quarter [/code] to be something like: [code] quarter = number / 0.25; [/code] If you have $1.78, you'll have 7 quarters, which is 1.78/0.25 (integer division truncates to 7). I don't think you want to % operator at …

Member Avatar for Dameon
0
114
Member Avatar for herms14

[QUOTE=herms14;648813]it also doesn't work. I've tried it but my outputs are some strange symbols nothing else..[/QUOTE] Ok this is just theory but-- Why not read every value (separated by spaces) as a string then sstream them into ints and store that sstream'd value into an indice of the array?

Member Avatar for CoolGamer48
0
122
Member Avatar for JConnor135

You forgot to return when the writeLine function reaches zero. Because of that it doesn't act as a sentinel, and writeLine just keeps writing String values to the screen. Also, it's a good idea to put your code in blocks during a condition. Here's the modified code. Msg me if …

Member Avatar for JConnor135
0
196
Member Avatar for dandan5448505

[QUOTE=Ancient Dragon;649237]I have no idea what you want. >>can help me? Can we help you do what?[/QUOTE] I think he wants our support...?

Member Avatar for vegaseat
0
35
Member Avatar for Gusts

[QUOTE=ivailosp;639857][code=cpp] int x = 21; x = (x << 2) + (x << 1) + x; //multiply number by 7 cout << x; [/code][/QUOTE] Can you not shift 0, or did you feel it was redundant?

Member Avatar for Alex Edwards
0
307
Member Avatar for hyliandanny

It could be that string is defined in namespace std, which you forgot to declare that you are using. Either that or declare-- [ICODE] using std::string [/icode] or-- [icode] std::string var; [/icode]

Member Avatar for Alex Edwards
0
76
Member Avatar for sangham

Wow sending data is that simplified in C++? My god, that is incredibly easy.

Member Avatar for mitrmkar
0
97
Member Avatar for JavaBeginner30

1) Please use Code Tags. 2) After just glancing through your project I noticed a huge error-- [code=java] Movie[0] = new Movie("I'm", 01, $1.00); Movie[1] = new Movie("In", 02, $2.00); Movie[3] = new Movie("Hell" 03, $3.00); // skipped Movie[2] Movie[4] = new Movie("Help!" 04, $4.00); // null pointer exception [/code] …

Member Avatar for Alex Edwards
0
106
Member Avatar for sambafriends

[QUOTE=sambafriends;647806]Hi, thanks for ur replay I need to explain classes in english and C++ I want the difference between procedural programming language and opps languages with beautiful example regards,[/QUOTE] Oh so you mean mid-level commands vs high level commands? [I]"Procedural programming A programming methodology involving a linear, 'shopping list' approach …

Member Avatar for CoolGamer48
0
113
Member Avatar for Alex Edwards

I still get here the same way I do every day - through a bookmark I have with this particular link: [url]http://www.daniweb.com/forums/post618391.html#post618391[/url] and I realize how poorly I first wrote less than 2 months ago when I first joined and started C++ I've learned a lot, and am still learning. …

Member Avatar for sciwizeh
0
100
Member Avatar for bloody_ninja

[QUOTE=bloody_ninja;644046]Hi, I just started research and playing around with Java a week ago. My uncle's company gave me all the necessary software and everything, and now I am trying to learn as much as I can in the fastest possible time. Browsing through the first page, I realized that I …

Member Avatar for bloody_ninja
0
180
Member Avatar for faisaly

[QUOTE=VernonDozier;647777]Is this you, or someone in the same class? [url]http://answerboard.cramster.com/computer-science-topic-5-287440-0.aspx[/url] Regardless, please check out the answer given and post back with any follow-up questions.[/QUOTE] Wow, talk about tracked down!

Member Avatar for Alex Edwards
0
339
Member Avatar for jack1234

[QUOTE=williamhemswort;647368]Yes, windows tend to do that for alot of types, and sometimes theres no need for them, for example in one of the header files I found these: [CODE=CPP] #define CONST const typedef int INT; typedef float FLOAT; [/CODE] and hunderds more.. ;)[/QUOTE] Hmm I wonder... [code=c++] typedef void VOID …

Member Avatar for CoolGamer48
0
127
Member Avatar for omarelmasry

[QUOTE=omarelmasry;646856]I am making a c++ program and i need a function that does the following: IF u have an n (e.g: 4) digit number (IN THE FORM OF AN ARRAY) , each digit can take the vlaue from 0 to m (e.g: 5) and can exist more than once in …

Member Avatar for Alex Edwards
0
148
Member Avatar for SonxQ7

[QUOTE=CoolGamer48;647417]But wait, doesn't this work? [CODE=C++] int x; cin >> x; [/CODE] x is an int, not a reference to one. Is it different when you're dealing with function return types and just the data type of a variable?[/QUOTE] x is technically a placeholder for an int, therefore it can …

Member Avatar for CoolGamer48
0
118
Member Avatar for Alex Edwards

Is it possible to send something like, a Frame or Applet to a target computer? If not, how would I set it up so that two users from two different computers could interact with the same JFrame or JApplet? Edit: No I'm not asking for code, just general advice*

Member Avatar for Alex Edwards
0
144
Member Avatar for gangsta gama

If you're serious about making a game, you should really write out (or type out) what is that you want to do in your game. Make a list with boxes next to each item (or "thing to do" ) then start programming around your list. Find out whats easy to …

Member Avatar for gangsta gama
0
176
Member Avatar for Alex Edwards

Forgive me for my lack of Java-lingo. In fact I'd like to find a book someday that will teach me all of the definitions of words that are mentioned for Java classes and objects, as well as processes, etc. If the title isn't at all clear, what I mean is …

Member Avatar for sciwizeh
0
92
Member Avatar for Alex Edwards

I'd like an opinion, although it will probably be biased since I'm asking the members of the C++ forum and not the members of Java. I'd also like to apologize in advance if this topic has been done before, but I don't like bumping old topics from years ago. I …

Member Avatar for sciwizeh
0
293
Member Avatar for Waseemn

[QUOTE=Waseemn;646736]Thank you for your reply. I did read up on the ArrayList, and unfortunately I am not allowed to use them due to the insistence of the instructor about not using anything not covered in class. I know where he is coming from, but again that limits us to what …

Member Avatar for Alex Edwards
0
152
Member Avatar for zwench
Member Avatar for Niner710

This is a little of topic, but what courses will you be specializing in? 5 days seems fairly quick unless it's a specialization training course then I'd understand. Sorry for the random question, just curious. Disregard it if you want to keep that kind of information confidential. -Alex

Member Avatar for Salem
0
355
Member Avatar for TheWhite

[QUOTE=TheWhite;645782]Because I have other code in my program that checks if(frame2 == null)... and having the X dispose() does not make it = null.. It just hides it there until you bring it up again... Is there a way to ask if a frame has been disposed because I could …

Member Avatar for Ezzaral
0
623
Member Avatar for Alex Edwards

I am wondering how one would append additional memory to the end of a pointer that already has memory allocated? For example, if I do something like this... [code=c++] int *intPtr = new int[5]; // pointer can be assigned 5 values of type int // Now I want to add …

Member Avatar for Narue
0
141
Member Avatar for Alex Edwards

I'm getting ridiculous results in my program! Seconds work fine Decaseconds (1/10 of a second) work ok Centiseconds seem a bit off Milliseconds are completely off... Here's the code-- [code=java] import javax.swing.*; import java.awt.event.*; public class Clock{ private Timer t; private long startTime = 0, finishTime = 0; private boolean …

Member Avatar for Alex Edwards
0
142
Member Avatar for d4n0wnz

[QUOTE=d4n0wnz;644717]Hi, I am taking a course that is Java based over the summer and the prerequisite class which I took a year ago was in c++ and has recently been switched over to java. So now the class expects me to have a good background in java but there is …

Member Avatar for rapperhuj
0
175
Member Avatar for programmingnoob

This actually reminded me of the project I'm working on. You could do something like this, where you use an Engageable interface to allow implementing classes to attack one another. Here's the interface (in Java) [code=java] //import CharacterData.*; //import DisplayPackage.*; /** * interface Engageable * Provides a means of Engagement …

Member Avatar for Alex Edwards
0
130
Member Avatar for Acidburn

[QUOTE=ssharish2005;644823] ... 1. [B]Java compiles the code to bytecode, not binary[/B] 2. It requires a JVM 3. It’s slow 4. Lack of pointers. 5. Needs huge amount of memory. And remember ATMEL AVR are RISC based processor. Does JVM support RISC architecture??? From my research it seems that ARM can …

Member Avatar for ssharish2005
0
168
Member Avatar for Waseemn

[QUOTE=Ezzaral;644685]You can use [URL="http://java.sun.com/javase/6/docs/api/java/lang/String.html#valueOf(long)"]String.valueOf(long)[/URL] to get a long into a string.[/QUOTE] If the instructor doesn't even allow the String API then... [code=java] public class Number_Manip{ public static void main(String[] args){ System.out.println(Number_Manip.numberToString(new Integer(8))); } public static String numberToString(Number num){ return "" + num; } } [/code]

Member Avatar for Ezzaral
0
125
Member Avatar for Khakimonk

You might need to make a minor edit-- [code=java] public class Grades { public static void main(String[]args) { Instructor grades = new Instructor(); grades.congratulateStudent( 'A' ); // enter a char as parameter here, 'A', 'B', 'C' etc char grade = args[0].charAt(0); } } [/code]

Member Avatar for Khakimonk
0
108
Member Avatar for sannidhikumar99

Rofl S.o.p 50 times... [code=java] public class LazyBass{ public static void main(String[] args) throws Exception{ System.out.println("Now you see me..."); Thread.sleep(2500); clrscr(); System.out.println("Now you don't!"); } public static void clrscr(){ for(int i = 0; i < 56; i++) System.out.println(); } } [/code] Edit: Looks like 56 is the lucky number!

Member Avatar for bloody_ninja
0
134
Member Avatar for twgood

Correct me if I'm wrong but do you mean Varargs? Example... [code=java] public class VarArgTest{ public static void main(String[] args){ String values1[] = {"Mom", "Dad", "Sis"}; VarArgTest.myVarArgMethod(values1); VarArgTest.myVarArgMethod(" ", " "); VarArgTest.myVarArgMethod("Yo", "This", "Rocks", "My", "Socks"); } public static void myVarArgMethod(String... strings){ for(String element : strings) System.out.println(element); } } [/code]

Member Avatar for masijade
-2
9K

The End.