2,827 Posted Topics

Member Avatar for and12

Put this line at the bottom of [ICODE]actionPerformed[/ICODE]: [code] validate (); [/code] That way you want have to minimize, maximize, etc. Regarding the Layout, I haven't had a chance to look at that yet.

Member Avatar for and12
0
113
Member Avatar for plato_03

[QUOTE=plato_03;954904]hello everyone, this is my first post. I have been teaching myself c++ for the last few weeks and have gotten more familiar with some of it. i thought to myself it would be interesting to try writing up some code that goes through numbers to see if they are …

Member Avatar for mrnutty
0
139
Member Avatar for Majestics

Robot will do fine for this problem, at least for part of this problem. Your main problem is this, I would imagine. Say you have three programs open: this Java program, Notepad, and a browser. At most, one of them will have the active focus. Or none of them could. …

Member Avatar for Majestics
0
188
Member Avatar for acplus

[QUOTE=acplus;955004]Did you mean this? else { cout << "File Error: Open Failed"; } It shows me the same error: "File Error: Open Failed"[/QUOTE] The else statement is one line, so it's irrelevant whether you put brackets around that one line or not. You were missing bracket at the end of …

Member Avatar for acplus
0
149
Member Avatar for NeoFryBoy

[QUOTE=NeoFryBoy;955013]Simple program opens a text file and counts all the lines. Then it returns the pointer to the beginning of the file and starts pulling in the lines for data manipulation. The Problem: If the file "triangle.txt" ends with a newline everything works fine until the last [i]while[/i] loop which …

Member Avatar for VernonDozier
0
132
Member Avatar for missty

[QUOTE=missty;955009]what is the difference betwwent "|" and "||"?[/QUOTE] || is "logical OR". | is "bitwise OR". From this site: [url]http://www.go4expert.com/forums/showthread.php?t=2891[/url] [quote] OR A bitwise OR takes two bit patterns of equal length, and produces another one of the same length by matching up corresponding bits and performing the logical OR …

Member Avatar for Dave Sinkula
0
200
Member Avatar for esesili

[QUOTE=esesili;954823]Hi all, I am trying to read double numbers from a txt file and calculate average and standard deviation. It builds successfully but gives an error when it is run. The error I see on the screen is -1.#IND. Do you have any idea what it is and how can …

Member Avatar for mrnutty
0
78
Member Avatar for idgirl

The bracket problems are hard to find because the indentation is so haphazard. I tried to format the code in NetBeans, but it came out all weird. Either it had a lot of problems parsing it due to errors or my setting are wrong. Anyway, here's your code in Java …

Member Avatar for VernonDozier
0
113
Member Avatar for jooa

Sounds like the problem is that your screen never clears so everything you ever painted is painted on the JPanel every time. Nothing gets erased. [code=JAVA] @Override public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; for (Shape s : shapes) { g2.setColor(Color.RED); g2.fill(s); g2.setColor(Color.BLACK); g2.draw(s); } } [/code] …

Member Avatar for jooa
0
1K
Member Avatar for VernonDozier

I'm adding really big numbers (a lot of them). I'm supposed to detect overflow errors. I did it years ago in Assembly by checking bits, but I've never done it in C++. [code] long long a = pow (2, 62.0); long long b = pow (2, 62.0); a += b; …

Member Avatar for Dave Sinkula
1
202
Member Avatar for picass0

[QUOTE=picass0;951825]i trying to write a code which will read from user input of the percentage of some words to be appear. [B][U]example[/U][/B] user will input 50 5 when the program runs. 50 is the total number of runs and 5 means of the total runs it will have 5% of …

Member Avatar for harsh2327
0
87
Member Avatar for gretty

If you are searching for a word, the fact that the array is alphabetically sorted would be useful and a binary search would be the way to go. But you're not searching for a word, you're searching for a regular expression within the word. You're also searching for ALL words …

Member Avatar for VernonDozier
0
441
Member Avatar for forever23

[QUOTE=niek_e;951920]How is this a descent reply to iamthwee's post? You reposted your first post, but added the word "tridesclist". Do you think someone is going to think: "Aaah! He's talkink about tridesclistes, this makes perfect sense now!" You'd be wrong. Give us more detail, as requested and also tell us …

Member Avatar for zoner7
0
75
Member Avatar for theo19

You have three switch (x) statements, each with one case inside. Have one switch(x) statement with three case statements instead. I don't see a [ICODE]nextChar[/ICODE] command in Scanner, so grab a whole line, then parse the String and grab the fist and hopefully only character in it. You might look …

Member Avatar for VernonDozier
0
4K
Member Avatar for kspicer

[QUOTE=kspicer;950663]Thanks for the reply, but that isn't what I was trying to do. The output isn't just the number of the counter, it's the particular digit in an array. Once it gets above 10, it's supposed to loop back to 0 and start over. Input/Output [B]0 | 0 9 | …

Member Avatar for kspicer
0
107
Member Avatar for the great

[QUOTE=the great;950227]Hello! I am having a problem in this program.In it a have to calculate the value of π from the infinite series π=4-4/3+4/5-4/7+4/9-4/11+..... by using this formula i have to print a table that shows the approximate value of π after each of the first 1,000 terms of this …

Member Avatar for StuXYZ
0
278
Member Avatar for akulkarni

Here's [a primer](http://java.sun.com/docs/books/tutorial/java/javaOO/thiskey.html) on this.

Member Avatar for VernonDozier
0
116
Member Avatar for ryancfc

[QUOTE=ryancfc;950360]I'm just looking to change health, I want to move to SDL but doesn't look like that will happen until I fully understand pointers. Basically I want to change the value of health, I know that health is private because this is the point of Object Oriented Programming.[/QUOTE] Go with …

Member Avatar for VernonDozier
0
93
Member Avatar for the great

Perhaps more details on the exact program spec and your programming experience? It may have an impact on the advice to give. I am wondering whether this is one of those rare cases where one takes advantage of the fact that switch statements can "fall through" without a break command …

Member Avatar for the great
0
1K
Member Avatar for vwyodapink

[QUOTE=tux4life;949513] Edit II:: So the resume my whole post in one line: [I]You could use structures for this[/I].[/QUOTE] Ha! How much time did it take you to write that one line, Tux? But your posts and the OP's post raise a point. Neither the OP nor tux4life is entirely sure …

Member Avatar for VernonDozier
0
513
Member Avatar for cougarclaws

[QUOTE=cougarclaws;949887]Is there an easier way to understand what this is doing step by step? I get very confused here, and I wonder if any of you fine people have a trick for breaking this down. I really want to get this, and understand the pattern, but what happens in the …

Member Avatar for cougarclaws
0
111
Member Avatar for ashish2234

You need to use code tags, as mentioned. And you need to format/indent. Your code is impossible to read due to inconsistent indentation, even in code tags. import java.awt.Graphics; import java.awt.*; import java.awt.Graphics2D; public class Main extends javax.swing.JFrame implements Runnable { String m1="hello"; Thread t =null; boolean flag; /** Creates …

Member Avatar for VernonDozier
0
106
Member Avatar for smoore

[QUOTE=smoore;949746]Okay so I posted my [URL="http://www.daniweb.com/forums/post936498.html#post936498"]first large project[/URL]a few weeks ago (2 or 3 i think) and now I finished another one! It is smaller then the 1st (about half the size) but still pretty cool I think. Anyway. It is called uCount and it is something I put together …

Member Avatar for VernonDozier
0
96
Member Avatar for llemes4011

[QUOTE=llemes4011;949726]Before I say anything else, I do realize that there are numerous threads on this topic, but I haven't been able to fix my problem. Okay. Well, here's my problem. I'm writing a map editor for the game that I'm working on, and the map is oftentimes much larger than …

Member Avatar for llemes4011
0
132
Member Avatar for cokaznsyco72

I did it on Dev C++, not Visual Studio. It compiled and ran, but did not work. When I changed the first part to this: [code=cplusplus] fstream writeFile; writeFile.open ("testFile.txt", ios::in); // To test if the file already exists if (writeFile.fail()) { writeFile.clear (); writeFile.open ("testFile.txt", ios::out); for (int row …

Member Avatar for WouterLindenhof
0
149
Member Avatar for adel_elrefaey
Member Avatar for adel_elrefaey
0
737
Member Avatar for surima

[QUOTE=surima;949049]how to generate number and characters together randomly. I know how to generate numbers randomly, but not getting anywhere with random character generation. Please help.. Thanks[/QUOTE] If you can pick a random letter and you pick a random integer, you can pick a random letter or integer, depending on the …

Member Avatar for JamesCherrill
0
152
Member Avatar for Roguey

[QUOTE=Roguey;947813]I'm trying to write a peice of code that will convert all the uppercase characters in a word to lowercase, and to store that in an array. I know how to convert individual characters, and to output all these characters in the fixed lower case. The thing i'm unsure about …

Member Avatar for mrnutty
0
447
Member Avatar for eaon21

Well this code can certainly be simplified. You don't need all of the cases. A nice formula based on i will do the trick: [code] for (int i=0; i<count; i++) { switch (terminals[i]) { case 1: coordinates[0][i]=(row); coordinates[1][i]=(col); break; case 2: coordinates[0][i]=(2*row); coordinates[1][i]=(col); break; case 3: coordinates[0][i]=(3*row); coordinates[1][i]=(col); break; case …

Member Avatar for VernonDozier
0
148
Member Avatar for clc571

> So this is going to sound like other posts but I have been racking my brain to figure this out. This code is a mod of one that my instructor posted, he said it was fine to just change the names of variables and submit it. When I did …

Member Avatar for VernonDozier
0
83
Member Avatar for charis89

Looking at your first post, it appears that you have a very common problem when mixing cin and getline. See this thread and see if that's about the behavior you are getting. [url]http://www.daniweb.com/forums/thread90228.html[/url] When you have a cin statement, followed at some point by a getline statement, the cin statement …

Member Avatar for Salem
1
164
Member Avatar for tankeetanx

One, do some formatting and indentation. It's impossible to read as it is. [code=JAVA] int x=1, y=1; String Str_1,Str_2; System.out.println("Enter an Equation: "); try { Str_1=dataIn.readLine(); System.out.print("Enter another Equation: "); Str_2=dataIn.readLine(); x=Integer.parseInt(Str_1); y=Integer.parseInt(Str_2); x = x+y; x = x-y; x = x*y; x = x/y; } [/code] Lines 3 and …

Member Avatar for VernonDozier
0
178
Member Avatar for skiing

[QUOTE=skiing;947335]I know that but how about if you are only to enter a seed number one time to initialize the integer generator rand()?[/QUOTE] Then put the seeding before the loop, not inside the loop: [code] cout<<"Enter a seed value : "; int seed = 0; cin >> seed; while(seed < …

Member Avatar for mrnutty
0
231
Member Avatar for gotm

[QUOTE=gotm;946921]But that one recipe that is in there has a rating of 3/5 stars. The initial rating picture the label uses is the 0/5 stars one. Shouldn't it load with the 3/5 stars picture from that code? Even if I go into the drop down list again, and click the …

Member Avatar for llemes4011
0
1K
Member Avatar for bervin

[code=JAVA] booean doneEnteringData = false; while (!doneEnteringData) { String name; double salary; int month; // ask for name if (/* name is empty */) doneEnteringData = true; else { // ask for month and salary and do whatever you do with it. } }[/code]

Member Avatar for TheWhite
0
98
Member Avatar for kvass

Lines 60 - 64 : Don't add and remove elements from the Applet. You already have a JLabel called Result. Keep it. Just change the text inside of it. [code=JAVA] String textNumber = Integer.toString (randomization); String newLabelContents = ultimo + textNumber; Result.setText (newLabelContents); [/code] Line 51 - You may want …

Member Avatar for kvass
1
136
Member Avatar for Hawkpath

[QUOTE=Hawkpath;944643]wow, thanks a lot. :) . I'm a beggining programmer (As you could probably tell) so allthat kinda blew my mind but thanks anyways[/QUOTE] Good explanation by Tom Gunn. Some of it may not make much sense if you haven't run across templates or classes or structures. We don't know …

Member Avatar for Hawkpath
0
107
Member Avatar for rip_snoopy

[QUOTE=amarucla;944984]You can use "map" container from STL which automatically sorts its contents by the key. First split each your lines by "|" token, using tokenizer command of c++, then store each line in the map with course code as key and the full line as value. The map finally contains …

Member Avatar for VernonDozier
0
114
Member Avatar for Nathan Campos

[QUOTE=Nathan Campos;944715]Hello, I'm learning Java and i want to build a program that save emails to an [i]*.txt[/i] file, like this: One guy send me an email, then the program periodically search if i have emails every 10 minutes and if i have it saves all the emails in a …

Member Avatar for Nathan Campos
0
113
Member Avatar for tarekwehbe

[QUOTE=tarekwehbe;944696]thx for nothing guys first time i post no help hehehe what a forum ... for the guys who replied i only asked for error 6 to 12 which take approx 5 min for an experianced programmer .... talking to me about morrality like im the immoral person....well if some …

Member Avatar for mrnutty
0
129
Member Avatar for sara khan

[QUOTE=sara khan;944655]can u tell me from where I can get more information about file handling and the functions of it..[/QUOTE] Google it! "C++ peek" gives the following as the first link. [url]http://www.cplusplus.com/reference/iostream/istream/peek/[/url] Bookmark the entire site. [url]http://www.cplusplus.com[/url] It's your first stop before you ask a question on a forum. Type …

Member Avatar for VernonDozier
0
217
Member Avatar for beatonl

If ComputerPart is the name of a class and you want to return an instance of that class, then getComputerPart shouldn't return an Integer. It should return something of type ComputerPart. Is there a class called ClassB somewhere? Regardless, parseInt returns an int. What are you TRYING to do? You'll …

Member Avatar for beatonl
0
183
Member Avatar for mandofl

Line 3 - Someone mentioned this earlier. Get rid of the space. Should be: [code] #include "EmployeeClass.cpp" [/code] not [code] #include "Employee Class.cpp" [/code] Don't mistake a warning for an error: [quote] warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. : see declaration of …

Member Avatar for mandofl
0
4K
Member Avatar for sieghuirt

Yes, please read the rules regarding code tags and chat-speak as well as this thread: http://catb.org/esr/faqs/smart-questions.html Here's your code: #include <iostream> using namespace std; void displayMenu() { system("cls"); cout << "+-------------------------------------+" << endl; cout << "| TetraPek Inc. |" << endl; cout << "|=====================================|" << endl; cout << "| Select: …

Member Avatar for VernonDozier
0
105
Member Avatar for Aseem_Pandey

Without seeing your sample input files and, more importantly, the original problem/program specification, and not knowing what the program is supposed to do, it's hard to offer any advice. What does Code Chef say is wrong (or does he/it say elaborate? I'm unfamiliar with Code Chef)? A link to the …

Member Avatar for Aseem_Pandey
0
135
Member Avatar for gopi17

[QUOTE=gopi17;942608]the problem is i'm not allowed to use arrays... [/QUOTE] Why not? One can always get around this stuff by using a vector instead that functions as an array, but I imagine that's cheating. There must be some reason why you're not allowed to use an array. I don't know …

Member Avatar for wildgoose
0
222
Member Avatar for sara khan

[QUOTE=sara khan;937043] i dont understand how the output is generated.. please help if anyone understand this....[/QUOTE] Which part of the output? I glanced over the assignment. First, there's a math aspect of the problem. You need to model/solve that and that is independent largely of the C++ programming implementation. Second, …

Member Avatar for sara khan
0
205
Member Avatar for Nathan Campos

[QUOTE=Nathan Campos;942947]Hello, I'm trying to get a string from a thing that is inside quotes as you can see [URL="http://www.daniweb.com/forums/thread209962.html"]here[/URL], but when i try to compile i got this errors: [code]ubuntu@eeepc:~/C++/Tree$ g++ -o tree tree.cpp tree.cpp: In function ‘int main(int, char**)’: tree.cpp:65: error: ‘get’ was not declared in this scope …

Member Avatar for Nathan Campos
0
1K
Member Avatar for Nathan Campos

You posted code, which is good, but didn't tell us whether the code works or what the input file should be, how to use your program, which part of the code to concentrate on, stuff like that. I'm not entirely sure what you want, but I think that this is …

Member Avatar for Nathan Campos
0
3K
Member Avatar for aliaks

I'd have a struct like this: [code] struct quizQuestion { string question; vector <string> possibleAnswers; string correctAnswer; }; [/code] Then have a vector of [ICODE]quizQuestion[/ICODE] that makes up the quiz.

Member Avatar for VernonDozier
0
166

The End.