2,827 Posted Topics

Member Avatar for teddyg18

[QUOTE=teddyg18;906632]I have a program in which i open a a text file, access it's values and create and array with it. for example the text file may contain these values: 1 44 3 4 33 6 7 8 61 10 ; that's 10 integers what c++ tools could i use …

Member Avatar for teddyg18
0
6K
Member Avatar for VernonDozier

OK, I haven't done much with Serialization. I have a simple program that creates four JPanels with different background colors and adds them to a larger JPanel using a 2 x 2 GridLayout. That larger JPanel is added to a JFrame. I've written my own serialization code to override the …

Member Avatar for VernonDozier
0
1K
Member Avatar for Menster

I don't know whether programmers are stoners, but I feel pretty confident that successful ones aren't stoned WHILE programming. It takes too much concentration and attention to detail, and it's hard work. Three things you don't feel like doing while stoned: concentrating, paying attention to details, and working hard. I've …

Member Avatar for Menster
0
142
Member Avatar for zeus1216gw

You add random numbers together the way you add any other numbers together. Initialize a sum variable to 0 and go through a for loop, adding each number. [code=cplusplus] if (n <= 100) {srand(time(NULL)); // seed cout << "Please enter the range you want (lowest to highest) : " <<endl; …

Member Avatar for zeus1216gw
0
100
Member Avatar for JChakra

[QUOTE=JChakra;908969]Call me stupid mate but I did not get it :P How on earth can I get coordinates from a piece of paper ? I never heard of this trick before please explain. :)[/QUOTE] The odds of you being able able to draw a Bezier Curve by hand on paper …

Member Avatar for JChakra
0
201
Member Avatar for PatrixCR

[QUOTE=curi0x;909887]Hi. I'm new to java programming. I have some questions: 1) Does every java source code's [B]class name[/B] (the name after the [I]class[/I] keyword, e.g. [I]class[/I] [B][I]Hello[/I][/B]) has to be started with an uppercase character? 2) Does the java source code's [B]file name[/B] (e.g. [I][B]Hello[/B][/I].java) has to be [U]exactly[/U] the …

Member Avatar for sincerelibran
0
320
Member Avatar for Flyin dagger

[QUOTE=joshSCH;806083]simply to give some dumbass poor people who are living on welfare a 10,000 square foot home. [/quote] I assume you can give examples of this? Sounds like the mythical Cadillac-driving Chicago welfare queen urban legend.

Member Avatar for Aia
0
783
Member Avatar for _dragonwolf_

Are you posting because you have more questions or just to show the final product? It still has major problems. Reread my comments in your prior thread(s). You still have arrays in printGrade. You should have none. You still have a loop in printGrade. There should not be a loop. …

Member Avatar for _dragonwolf_
0
136
Member Avatar for XodoX

I see no arrays in your code. I think you're going to have to re-explain what you're trying to do. I for one don't understand what your goal is or what your question is, particularly this phrase: [quote] a number above my multidimensional array [/quote] What does this mean? How …

Member Avatar for NathanOliver
0
103
Member Avatar for Pokenerd

Lines 10 and 17. You define nCelsius as an integer, then you read it in as integer. If it's NOT an integer, the >> operation fails. Since you can't ASSUME it's an integer (that's the whole reason you're checking), you can't read it in as an integer. Read it in …

Member Avatar for Pokenerd
0
180
Member Avatar for zeus1216gw

[QUOTE=zeus1216gw;909785]I know how to make random numbers. and How to make random numbers in a specific range. BUT!!! How can you display 'x' random numbers in a given range and make it so the output display lists the numbers in groups a 'y'. For example: I want to display 25 …

Member Avatar for csurfer
0
115
Member Avatar for _dragonwolf_

tooMany is never used in this function: [code] void readStudentData(ifstream &rss, int scores[], int id[], int &count, bool &tooMany) [/code] You should find out what you are supposed to do with tooMany. readStudentData should do just that: read the student data. It shouldn't display anything except possibly error messages. You …

Member Avatar for VernonDozier
0
281
Member Avatar for llemes4011

[QUOTE=llemes4011;906810]Hi. When I add a JComponent to my JFrame, it isn't the size of the remaining space in the frame. I want it to work in a way so that when i add a JComponent, it (and it's contents) stretches to fill the remaining space in the screen... Is there …

Member Avatar for llemes4011
0
144
Member Avatar for lotrsimp12345

[code] cout<<"enter max number of characters in the sentence"; int number; cin>>number; cout<<"enter a sentence"; char let; [COLOR="Red"]char mycstring[number+1];[/COLOR] [/code] This is actually compiling for me and I'm a little surprised, since I was taught to never do this. Aren't you either supposed to make [ICODE]number [/ICODE]a constant or allocate …

Member Avatar for smart_pc
0
226
Member Avatar for _dragonwolf_

DO NOT declare new arrays inside your functions! You've already declared them and provided storage for them in main here: [code] [COLOR="Red"] const int MAX_SIZE = 21; [/COLOR] rss.open("studentData.txt"); string line; [COLOR="Red"] id[MAX_SIZE]; int score[MAX_SIZE]; [/COLOR][/code] Don't do it anywhere else, like here: [code] void readStudentData(ifstream &rss, [COLOR="Green"]int scores[], int …

Member Avatar for _dragonwolf_
0
103
Member Avatar for Acegikmo

More details are needed and a more precise question. What exactly are you having problems with? The math/physics formulas regarding acceleration/velocity at different ramp angles? The coding of the math/physics formulas regarding acceleration/velocity? Having a figure "walk" at a certain velocity on a line in a GUI (i.e. swing repaints, …

Member Avatar for VernonDozier
0
279
Member Avatar for sympatiko

> im a newbie in programming,,i cant understand those kind of coding,,can you please solve my problem if you know? The request to use code tags has nothing to do with programming ability; code tags are required because all spacing/formatting is stripped out when you do not use them. Your …

Member Avatar for VernonDozier
0
698
Member Avatar for kssi89

Regarding the ternary operator inside the for-statement, I've never been any good with the ternary operator and rarely use it. I've never seen it inside of a for-statement though, which doesn't mean it can't be done, just that I've never seen it. So I can be of no help in …

Member Avatar for JamesCherrill
0
141
Member Avatar for fourstar

[QUOTE=fourstar;907781]Ok thanks for the help. I got that part figured out now. It turns out I was using [CODE] if(isdigit(numIn[i]) == true) [/CODE] and I shouldn't have been using [CODE]== true[/CODE] Now I'm trying to figure out how to reject any input that is from "G"-"Z" as those aren't valid …

Member Avatar for VernonDozier
0
121
Member Avatar for srrjason

Code tags: [code] paste code here [/code] or [code=JAVA] paste code here [/code] There are other classes that you haven't posted so we can't run it. There is no line 10, at least with the code tags that Tekmaven added, so please repost with code tags: [code=JAVA] paste code here …

Member Avatar for VernonDozier
0
152
Member Avatar for VernonDozier

I'm pulling my hair out on this one. It's been a while since I've specified a path for an ofstream. I just want a simple file called "abc.txt" in the C: folder and I want to write "abc" to it. Anyone see anything wrong? Thanks. [code] #include <fstream> using namespace …

Member Avatar for VernonDozier
0
116
Member Avatar for einhachi

[QUOTE=einhachi;904450]Sorry- I forgot to include a picture in my previous post.[/QUOTE] I ran it and I got the Java mug and the window, so not sure what's up there. Regarding the fact that you have to forcibly close it, I've never worked with Frames much, and I don't see a …

Member Avatar for painless
0
184
Member Avatar for sympatiko

[url]http://www.daniweb.com/forums/thread200252.html[/url] Same poster, same bad attitude.

Member Avatar for VernonDozier
0
112
Member Avatar for _dragonwolf_

How you do it is going to depend on what you know already. Someone who is familiar with classes would use a class. If you haven't used classes, you wouldn't do that. Similarly someone who has used vectors may well use them instead of arrays. Looks like you are required …

Member Avatar for jephthah
0
123
Member Avatar for joed13k1941

[QUOTE=mjf5012;708371]Ok. I have been trying. I am unsure of how to prompt the user to give input without asking a question or entering a statement. This is the 17th assignment and I have been breezing through until now. Can someone please get me started so I can visually see what …

Member Avatar for collegetextbook
0
304
Member Avatar for lovley

Code tags: [code=JAVA] paste code here [/code] It's impossible to read otherwise. public class Student { private String string; private int id; private String[] classList; private double gpa; private double[] gradeList; private double effectiveGPA; private double myGradeType; private double nGrade; public enum GradeType { A, B, C, D, F }; …

Member Avatar for VernonDozier
0
246
Member Avatar for akulkarni

[QUOTE=akulkarni;904368]i wish to print something like this ******** r ******* er ter uter puter mputer omputer computer where * is a blank space for each line i used array of strings String []s1=new String [20] for 5 blank spaces i used s1+" " + " "..+(5)"" then 4 blank spaces …

Member Avatar for VernonDozier
0
202
Member Avatar for Debby0424
Member Avatar for Democles

[QUOTE=Democles;905711]I am attempting to take names and weights from strings and just simply output them. For some reason it can't get out of the while loop, it just sets there waiting for the users to input names and weights. Here's my code [code=C++] #include <iostream> #include <string> #include <vector> using …

Member Avatar for VernonDozier
0
11K
Member Avatar for zeus1216gw

[QUOTE=zeus1216gw;903593]what kind of other stuff? I'm very new to this so any help it welcome.[/QUOTE] Other stuff like this: [code] b=pow(a,x); c=pow(2.71828, -a); d=b*c; fact*=x; e=d/fact; [/code] You have probabilities, you're using the value of e, etc., other stuff that may USE factorials, but which has nothing to do with …

Member Avatar for tux4life
0
174
Member Avatar for lotrsimp12345

You should be using this function: [url]http://www.cplusplus.com/reference/string/string/find_first_of/[/url] [code] string delimeters = ".?!"; string passage = "ab.cd.ef!gh?ij."; int pos = passage.find_first_of (delimiters); [/code] It'll find the first incidence of '.', '?', or '!', which will be index 2. Then erase the first 3 characters using erase, as you've been doing, and …

Member Avatar for lotrsimp12345
0
130
Member Avatar for crash1989

[QUOTE=siddhant3s;899905]Guess what!! I derived a O(1) formula for the same. If it is your homework, don't try to copy the formula. I am sure you teacher will ask you derive it if you do so. [tex]r=floor\left (\frac{3\times n}{2} \right )-1[/tex] where floor() is the greatest integer function floor(3.2)=3 floor(6.1)=6 floor(6)=6[/QUOTE] …

Member Avatar for crash1989
0
642
Member Avatar for san26

[QUOTE=san26;902701]i have developed coding upto step 5 btt after that i am getting confused..............so plz help and if u want to see my work i can post here...............[/QUOTE] Yeah, post the work here and a specific question. And mark the other thread solved.

Member Avatar for Nick Evan
0
132
Member Avatar for Acegikmo

[QUOTE=Acegikmo;902546]After I've been running my program for a while, it freezes and gives me this error in the console: [COLOR="Red"]Exception in thread "Thread-4" java.lang.IllegalArgumentException: timeout value is negative at java.lang.Thread.sleep(Native Method)[/COLOR] It gives me a line to where the error occurs, which is the same line where it says "try": …

Member Avatar for Acegikmo
0
2K
Member Avatar for SP IT

[code] #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int int main(void) { unsigned seed = time (0); srand(seed); cout<<"First Array"<<endl; {int a1[45] = {1 + rand () % 45}; cout <<a1[45]<<endl;} cout<<"SecondArray"<<endl; {int a2[50] = {rand () %50}; if (a2[50] % 5 ==0) cout<<a2[50]<<endl;} cout<<"Third Array"<<endl; int max(0); …

Member Avatar for csurfer
0
119
Member Avatar for lotrsimp12345

[QUOTE=lotrsimp12345;902697]i think that using stringstream might work.[/QUOTE] All sorts of things would work. If it were me, I'd read in the whole line with getline, then parse it. Delimiters would be commas and dashes, after you extracted the first letter.

Member Avatar for VernonDozier
0
202
Member Avatar for valinux

[QUOTE=valinux;899448]I have never programmed before or used Linux (didn't even know what that was before a few days ago,) well I got a book for beginning C++ and a book for Ubuntu Linux. My stepdad says it would be best to learn C++ on windows and not to even mess …

Member Avatar for tux4life
0
169
Member Avatar for VernonDozier

I have a movie-player type application. You have a movie of JPanels that you can "play", that is you can have the frames change either automatically on a timer or by advancing a frame at a time manually. I've created 4 trivial frames (simple JPanels with different colors). It can …

Member Avatar for kvprajapati
0
3K
Member Avatar for joshmo

[QUOTE=joshmo;899938]I have a code that calls a method, but after this call, any code after it is not executed....here is the method call skeleton [code=java] if(//some condition){ //some code myMethod(//some variables); //some code/*not executed*/ }[/code] the calling is done well but the code stays in that method i.e code following …

Member Avatar for joshmo
0
137
Member Avatar for malugirl4

You already have an earlier thread on this subject. Have you read the responses? [code=JAVA] robot_instructions[0] = 1; maze[4][5] = 2; maze[6][7] = 3; maze[1][1] = 1; maze[8][8] = 4; maze[3][2] = 3; maze[4][1] = 2; robot_x = 1; robot_y = 1; for(i = 0; i < 64; i++) { …

Member Avatar for VernonDozier
0
101
Member Avatar for pmankow

[QUOTE=pmankow;900905]Hello, I am looking to make a program that will generate prime numbers. The program has to start at a specific number, ex: 3698741 and then end at another specific number, ex: 9874123. The numbers may never have duplicate digits, ex: 9874122. There will be a set of rules as …

Member Avatar for WaltP
0
106
Member Avatar for malugirl4
Re: maze

[QUOTE=malugirl4;900421]Sorry this is my first time on this site. Well I dont know if I need that, or if i'm fine with the rest of the code. I just need to add the robot going through the maze and its frustrating cause I know its prob. something simple.[/QUOTE] You're not …

Member Avatar for VernonDozier
0
116
Member Avatar for tag5

You need to have a loop where you extract a digit at a time. You need to know the place (i.e. hundreds, thousands) and the digit (0 through 9). 10 through 19 are special cases, and you'll have to deal with "twenty", 'thirty", "forty", etc., so you'll have some if …

Member Avatar for u8sand
0
313
Member Avatar for johndb

Are you using NetBeans or Eclipse? In NetBeans, create a new project, category = "Java", Project = "Java Class Library", then add a new class to the Default Package called "ColorSelect". Copy and paste your code into that file. Do a "Clean and Build" on the project, then go into …

Member Avatar for johndb
0
4K
Member Avatar for kuay

Should we post here or [URL="http://www.daniweb.com/forums/thread198833.html"]here[/URL]? You only need one thread.

Member Avatar for ~s.o.s~
0
132
Member Avatar for Nikhar

These two code snippets may be useful. No vectors, not goto statements. [url]http://www.daniweb.com/code/snippet1034.html[/url] [url]http://www.daniweb.com/code/snippet1179.html[/url] You're in a tough bind. It's unfortunate that, for some strange reason, many Computer Science teachers insist on using outdated compilers when there are modern, free compilers out there. Probably it's what they are used to …

Member Avatar for siddhant3s
0
160
Member Avatar for Pavan_

[QUOTE=Pavan_;896187]but i am not including ny header file then how compiler knows about std?[/QUOTE] You don't need to put this line: [code] using namespace std; [/code] The compiler is looking for namespaces and it looks for [ICODE]std::[/ICODE] without you telling it to look for [ICODE]std::[/ICODE]. The following program compiles and …

Member Avatar for Salem
0
218
Member Avatar for localp

[QUOTE=localp;897130]The code found below takes command lines arguiments and displays. I want to modify this code in anyway that it would take 2 set of command line arguiments and produces 2 outputs. (That means , Open 2 command prompts and run the code) ex: first cmd prmpt -> java CmdLnArgmntExp …

Member Avatar for VernonDozier
0
194
Member Avatar for dharm93

[QUOTE=dharm93;896410]Attached is my code. I posted this twice on accident earlier, and I didnt attach the code which caused the users discomfort. My problem is that i keep getting a segmentation fault and I can't understand why. The problem occurs during the decryption part of the program. My other question …

Member Avatar for VernonDozier
-1
181
Member Avatar for kuay

I explained how to use code tags here. You need to use them. [url]http://www.daniweb.com/forums/post896175-3.html[/url]

Member Avatar for VernonDozier
0
80

The End.