2,827 Posted Topics
Re: [QUOTE=mostermand;990882]Hi I have a problem, I hope you can help me with. I have a number, which I need to compare to some values. I do not wish to go through all the values, and compare them individually, as I there are too many for it to be efficient. Neither … | |
Re: [QUOTE=pvt_geeker;988907]Hello, JAVA community. I am currently working on developing a system (Hotel Reservation System) as academic work. I am using Netbean IDE 6.7 and MySQL or MS SQL as development tools. I am quite amateur with the use of Netbean, I also find that manual coding is very tedious. So, … | |
Re: You need to give the user the option of typing in a value that represents that there are no more values to enter. Perhaps give a prompt like: [code] Please enter a value. Enter -999999 if you have no more values [B]:[/B] [/code] As for the ten (or fewer) values, … | |
Re: [QUOTE=DdoubleD;987476]It's based on C, so I believe the answer is absolutely and the same.... perhaps someone will have more to add to this...[/QUOTE] If you can do it in C, you can almost certainly do it in C++. In a handful of rare cases, this not being one of them, … | |
Re: difftime returns the difference in time in seconds, not minutes, so you would have to divide by 60 to get the number of minutes. difftime wants two time_t objects: [url]http://www.cplusplus.com/reference/clibrary/ctime/difftime/[/url] [code] double difftime ( time_t time2, time_t time1 )[B];[/B][/code] I don't know what [ICODE]time[/ICODE] represents here: [code]diff = difftime(startdate,time)[B];[/B][/code] Is … | |
Re: I would imagine that the fact that the data is coming from a file is irrelevant to the withdraw and deposit functions. You're probably supposed to adjust balance: [code] void SavingsAccount::deposit(double amount) { balance += amount; } [/code] Can't see what else it would be. | |
Re: [QUOTE=leverin4;988330]I tried searching and couldn't find anything, so I'm sorry if this has been posted before. I need help aligning output at the command line. I want to make even columns, but can't figure out how to do it. Attached is a screenshot of my current output. I want the … | |
Re: Start by making sure you understand what exactly you are supposed to do. Start by making sure you understand what all of these functions are supposed to do and why he has main the way he has it. Start by spending a considerable amount of time doing all of these … | |
Re: You have no [ICODE]System.out.println[/ICODE] statements in either the functions themselves or the calling statements. You create the String you want to display to the screen, but never display the String. Since your functions have the word "Display" in them, I imagine you want the System.out.println command in the functions. And … | |
Re: [QUOTE=Samyx;985250]Sorry, I should had paid attention. How can I return the list of words? and how do I find an anagram?[/QUOTE] You made words[] global, so you don't have to return it or pass it. You do have a potential problem in that you declare a local variable with the … | |
Re: One, who wrote this code? Is it yours? Two, what exactly is the problem? We need a more specific question. Point us to the section of the code to look at it. Three, repost in code tags with formatting/indentation: [noparse] [code=JAVA] // paste code here [/code] [/noparse] | |
Re: If the person you are copying is who I think it is, be aware that there are many flaws in his code. He would ask questions, get answers, but do a seemingly random copy and paste of the answers, but often in an incorrect way, so the end result, often, … | |
Re: [QUOTE=Jennifer84;681678]If I understand you would meen an example like the code below. I use a file to write i to it but nothing is written to the file. If I change to: [COLOR="Red"]for( int i = 0; i < 10; i+=1 )[/COLOR] then it writes i to the file. [code] … | |
Re: You want to use getline instead of the >> operator. [url]http://www.cplusplus.com/reference/iostream/istream/getline/[/url] | |
Re: [QUOTE=hao001;986462]Hi..i saw this a randomly..i got some part don't understand: [url]http://www.daniweb.com/forums/thread214624.html[/url] @ancient dragon's reply 1) const unsigned int MAX_SIZE = 2; student array[MAX_SIZE]; Q: Why MAX_SIZE = 2 ? 2)15: void insert(student array[],const unsigned int MAX_STUDENT); 33: void mySort(student array[],const unsigned int MAX) 55: void display(const student array[], unsigned int … | |
Re: [QUOTE=icu222much;985238]I am new to programming in C++. I have a bit of experience in Python and ActionScript3. I decided to pick up C++ so I downloaded Dev-C++ complier. I tried to run the following code but it doesn't seem to do anything. I complied the code, and it did not … | |
Re: One, you have some semicolons directly after your if statment and your else statement. They may not be errors, but you don't want them. Two, x is a float, so the % operator doesn't make much sense if you use it with a float. Are you sure you want x … | |
Re: [QUOTE=hao001;986399]Hi..i saw this thread randomly..i got some part don't understand: 1) const unsigned int MAX_SIZE = 2; student array[MAX_SIZE]; Q: Why MAX_SIZE = 2 ? 2)15: void insert(student array[],const unsigned int MAX_STUDENT); 33: void mySort(student array[],const unsigned int MAX) 55: void display(const student array[], unsigned int MAX); Q: 1. From … | |
Re: You can use pointers and pointer arithmetic to isolate the characters in a string, but I think the code is much more readable if you use the [] operator... char* address = "[email protected]"; for (int i = 0; i < strlen (address); i++) { char letter = address[i]; cout << … | |
Re: Chalk it up as a learning experience. There's absolutely nothing you can do about it. You have a half hour to reconsider your post and have second thoughts. In that time period, you can edit it down to nothing. Of course, if someone else has RESPONDED to your quote and … | |
Re: And again, read the other half dozen threads on the same topic that you have started. [url]http://www.daniweb.com/forums/thread215686.html[/url] | |
Re: [QUOTE=Hiroshe;934825]It's a stratagy to make your teachers stop asking you questions. :P I kinda wrote it as I was looking it up so it ended up slightly longer than I thought. Also didn't notice the scroll bar shrinking. Oww well :$[/QUOTE] I liked the essay. +rep. Some good points. | |
Re: Line 51 - You're assigning a string to itself. What's the point? Lines 49 - 52 - Either use a loop or recursion. Not both. You are required to use recursion, so don't use a loop. Line 47 - You are overwriting the parameter you passed to the function without … | |
Re: Seems similar to this thread. Tux's advice is good. Split everything up into smaller tasks. [url]http://www.daniweb.com/forums/thread221572.html[/url] I'll add the same advice that I gave the person in the thread I linked. Don't hard-code the keys (37, 173, 200). Have variables for them and give them descriptive names. And when you're … | |
Re: [QUOTE=droeph;983750]Ok I made the changes but I still get incompatible types for case 2 : MonthDescription = "February"; dayDescription = (Year % 4 == 0 && Year % 100 != 0) || (Year % 400 == 0) ? 28: 29;[/QUOTE] You made the changes? What changes did you make? You … | |
Re: //for loop for (line=1; line <=height; line++) { for(col=1; col <=line; col++) { if (line%2 !=0)// odd line { if (col%2 != 0)//odd line,odd col System.out.print(A); else //(col%2 == 0) //odd line, even col System.out.print(B); } if (line%2 == 0)//even line { if(col%2 !=0)//even line, odd col System.out.print(A); else //(col%2 … | |
I see a potential problem with the new format regarding code tags. Before, you had the option of doing this: [code] // paste code here - Courier-style fomatting, multiple spaces allowed, but no line numbers or syntax highlighting. [/code] or this: [code=cplusplus] // paste code here - Courier-style fomatting, multiple … | |
Re: [QUOTE=feartrich;984655]This supposed to return the user's BMI. But the output is always 0. Why is that? [code=java] import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.text.DecimalFormat; public class bmi extends JApplet implements ActionListener { JTextField inputLbs, inputInches, displayBmi; public void init() { JLabel labelLbs = new JLabel("Weight (lbs):", SwingConstants.RIGHT); inputLbs = … | |
Re: [QUOTE=Kioti16;981120]It is not a real .dll file just a .txt file. Oh and the part I need help with says: //Problems start here //<-------------------------------------------> //Problems end here //<-------------------------------------------> Can you help me, thanks.[/QUOTE] Call it a text file then. Anyone seeing a .dll extension expects it to be a DLL … | |
Re: [QUOTE=firstPerson;984459]I haven't ever used CLA so I had to ask. For simplicity sake, Say I have a program that takes in at most 5 arguments. The arguments from args[1] - args[4] has to be some numbers. These number will be used for something, say to calculate its average. How could … | |
Re: Close on the code tags: [code=cpluplus] #include <cstdlib> #include <string> #include<iostream> #ifndef MARK_FOO #define MARK_FOO #include "node.h" struct node{ std::string data; node* next; }; class LinkedList { typedef std::string value_type; typedef size_t size_type; public: //constructors LinkedList(); LinkedList(const LinkedList& obj); ~LinkedList(); //mutating member functions void Insert_Node_tail( node* tail_ptr, value_type entry); void … | |
Re: [QUOTE=ganesh.guddu;983877] PLEASE NOTE THAT I DON'T HAVE PERMISSION TO MODIFY THE SOURCE CODE OF EXISTING CLASS .. So please tell me how to proceed to get the solution .. [/QUOTE] If you can't modify the source code of class A or class B, then what are you allowed to do? | |
Re: You have too many swaps for a selection sort. You should have at most one swap for every trip through the outer loop, so you should not have a swap inside the INNER loop. The algorithm, from Wikipedia. [LIST=1] [*]Find the minimum value in the list [*]Swap it with the … | |
Re: Line 9 - Am I correct that this doesn't compile? I'd say you need to post a driver/main program for anyone to make any sense of these functions. It could make perfect sense, but not knowing what i represents and not knowing what the book[] array is initialized to be, … | |
Re: You have brackets problems which will be impossible to solve until you format your code with consistent indentation. NetBeans and Visual Studio will do that for you. Then start counting brackets and make sure you don't have more ending brackets than starting brackets, or vice versa. | |
Re: [QUOTE=nope3d;980462]I am having a problem in this program....can anybody help me create a BufferedReader out of this maze problem... [/QUOTE] Yes. [QUOTE=nope3d;980462] then i have to create a text document entitled with maze.txt... [/QUOTE] Okay. If you want better answers, you're going to have to ask more detailed questions, particularly … | |
Re: [QUOTE=Alexia Noir;981819]hi there. say i have a text file. in this text file is all the information i need for my output. the problem is, probably because i'm still very new at this, i don't know how to read this particular text file and output it onto the screen. suppose … | |
Re: You need a compare function and a swap function: [code] int compare (data item1, data item2) { // returns -1 if item1 is "before" item2 // returns 0 if item1 and item2 have "equal" value regarding ordering // returns 1 if item2 is "before" item1 // You'll have to decide … | |
Re: [QUOTE=robgeek;978913]I am trying to write a program in which a big text file is read and then user searches for a word and replaces it with another word. To implement this I was thinking to store the file read into an array since that would the easiest way to implement … | |
Re: [QUOTE=Bladtman242;978895] it doesent even wait for input. it seems like the [icode]getline (cin,plac);[/icode] is ignored?[/QUOTE] Yes, it doesn't wait for input. It isn't ignored, but it DOES ignore YOU, as in it doesn't wait for you to enter anything because it already has an unused newline in the cin stream … | |
Re: [QUOTE=GooeyG;979861] Everything seems to work, but when you input more than 40 hours, it doesn't calculate overtime.[/quote] You make no attempt to calculate overtime. [code] float OverTime::getsalary() { return hoursWork * hourlyRate; } [/code] [QUOTE=GooeyG;979861] Another thing is that, i can't get a message to pop up when someone input … | |
Re: This is a perfect candidate for a 4 x 4 GridLayout. [url]http://java.sun.com/docs/books/tutorial/uiswing/layout/grid.html[/url] [url]http://java.sun.com/javase/6/docs/api/java/awt/GridLayout.html[/url] | |
Re: [QUOTE=rainny;980269]I wish to develop a program which used to play the sound file. The problem I face now is I wish can play the sound file when select the userID from mysql database. For example, when I select one of the userID from combobox, then the sound file can automatically … | |
Re: Well, do you have ten rungs or six? [quote] I have a ladder with 6 rungs. I can climb up 1 rung, 2 rungs, or 3 rungs at a time. The goal is to find every way I can climb up 10 rungs. [/quote] One way to do it is … | |
Re: [QUOTE=vmanes;979751]"Hello world", of course. It's the law![/QUOTE] Followed by "Hello <Your name here>". | |
Re: [QUOTE=treyd;979007]This is where I am now: [ICODE]public class Avgtwod { public static int[][] avgRows(int[][] a) { int[][] avgRows = {{1, 2, 3}, {3, 4, 5}}; for (int row = 0; row < avgRows[0].length; row++) { int total = 0; for (int column = 0; column < avgRows.length; column++) { total … | |
Re: I don't see a PrintDashes () function anywhere. If you add one, then type "g++ main.cpp" in Linux, it compiles for me. Is there a makefile for this? Maybe it's trying to compile project01.cpp into object code and then link, in which case project01.cpp won't know anything about MAX_COLS. But … | |
Re: [QUOTE=ItecKid;979824]Hello, I am writing a C++ program to find the largest such number such that the square root of that number is less than or equal to a fixed number, set by me, like this: [code=c++] #include <stdio.h> #include <math.h> int main (void) { long fixed, param, result; result = … | |
Re: [QUOTE=Der_sed;978893]I know that an array matrix would have been better but Im taking a freshman course so coulnt use it. 1- Tic tac toe grid is defined from locations 1 to 9 2- For loop executes 9 times for 9 turns 3- A functions takes all 9 locations as argument … | |
Re: [quote] Could anyone help me on finding all magic numbers using JAVA with 1000 iterations or less? [/quote] You may need to elaborate on what precisely this restriction means, including the word "iterate". I imagine it means that this brute-force method is no good: [code] for (int i = 100000; … |
The End.