318 Posted Topics

Member Avatar for cppjosh

The problem lies in your main method. You cannot concatenate strings using + in c++. You simply use the << operator again. [CODE]cout << "Manufacturer's Name: "<<t1.getManuName();[/CODE]

Member Avatar for Akill10
0
365
Member Avatar for Akill10

Hey, I'm not too sure what the problem is here, I have never had trouble using fscanf before. The following shows the code I use to check the file, and the result. [CODE]while( true ) { int vals_read = fscanf(fileHandle,"%[^;];%s",&name,&pass); if( vals_read == 2 ) { // process the line …

Member Avatar for Akill10
0
171
Member Avatar for madrimer

1. Think of a structure that you could use to store a number of rows and columns of "something" 2. Make sure the number of mines cannot be larger than that structure. 3. Think of a suitable way to display your board. i.e. a mine as a * symbol etc. …

Member Avatar for Akill10
0
160
Member Avatar for w1mark

What do you mean by an unordered linked list of classes? I don't understand that bit. I think you mean objects? To "get" objects from a linked list, I suppose you mean, how to access the data at a particular node? What you usually do, is create a separate iterator …

Member Avatar for w1mark
0
280
Member Avatar for ichigo_cool

[QUOTE=ichigo_cool;1524689]Thanks for helping, I found the solution, all I needed to use was default variables so I don't need to pass in any arguments from main[/QUOTE] If you don't need to ever enter paramaters, then just setting the values in the constructor will do, setting all params to default is …

Member Avatar for L7Sqr
0
94
Member Avatar for DarKKendO

[QUOTE=DarKKendO;1524739]the assignment basically gets us to write a basic Linked list so that we better appreciate the underlying structure. I think I've got it sorted now though. The problem was that I wasn't declaring an instance of the object in the main method. I added DictionaryTree test; as the first …

Member Avatar for DarKKendO
0
102
Member Avatar for ashrafu1

[QUOTE=Fbody;1502726]I really don't see anything wrong with the lines you have mentioned as suspects for the problem. They all appear to be properly-written output statements. Your issue is is actually an input issue. It's caused by the input stream getting corrupted. What is struct emp intended to represent? It looks …

Member Avatar for ashrafu1
0
183
Member Avatar for NvIs

Have you seen the videos on this link: [url]http://xoax.net/comp/sci/algorithms/[/url] It is explained visually, which is much easier to grasp.

Member Avatar for thekashyap
0
173
Member Avatar for ryannans

Is this what you need? [CODE] #include <iostream> int main(int argc, char* argv[]) { std::cout<<"Hi!\n"<<std::endl; std::cout<<"enter 15 integers in the range of 1-20.find how many of these values fall in the range of 1-50, 51-100, 101-150 and 151-200.Validate the input so that only values from 1-200 will be entered."<<std::endl; for(int …

Member Avatar for arkoenig
0
230
Member Avatar for inni2626
Member Avatar for Akill10

Hey, I am having trouble trying to set a default value for a function in one of my classes. Here is where I am trying to set it: [CODE] void Sprite::Spr_Blit(SDL_Surface* source, SDL_Surface* dest, SDL_Rect* clip = NULL) { SDL_Rect offset; offset.x = getX(); offset.y =getY(); SDL_BlitSurface(source,clip,dest,&offset); } [/CODE] Here …

Member Avatar for RyanMcMillan
0
154
Member Avatar for Akill10

Hey, I am starting to work with SDL and I had it all set up correctly etc. The thing that does not seem to be working correctly is the SDL_ttf. Now, As far as I am aware, linux builds don't use truetype, which is why I am at a loss …

Member Avatar for Akill10
0
176
Member Avatar for miminj
Member Avatar for churva_churva

1000 lines of code, and you ask how to fix it? Have you not tested your program as you wrote the thing? Please come back when you have a snippet of your exact problem. This isn't your personal debugging community.

Member Avatar for churva_churva
0
766
Member Avatar for Progr4mmer

You wouldn't normally have both the declaration and initialization of TextFields etc in the same method. Most of the time, you would declare all your forms controls etc as global variables. Then call some initialise method from your class constructor. The way you did it, your JTextFields are local to …

Member Avatar for Progr4mmer
0
225
Member Avatar for Akill10

Can't believe it has gotten to this. I cannot for the life of me figure out what is messing up my desired outcome. Here is the story: I have a small GUI program for a sports club. I have 3 list boxes, 1 for each U10's,U12's and U14 children. I …

Member Avatar for mKorbel
0
324
Member Avatar for Magekiller

You are not doing anything with the 3 lengths that you request from the user, You still need to use the methods you created. Also, on your first method you have not specified a return type in the method declaration, so that should cause a compile error.

Member Avatar for Akill10
0
147
Member Avatar for Sundayy
Member Avatar for Gheter
Member Avatar for Aldoody

At first glance, [CODE]static void Triple(int num 1, int num2,int num3 ) {[/CODE] this seems to be your only problem. You have separated the variable name in your num1 variable. You have num 1.

Member Avatar for ztini
0
115
Member Avatar for SeePlusPlus2

Look at your cout statement: [CODE]"Current Price << setw(7) << "$P/L" << setw(7) << "%P/L"<<endl;[/CODE] Your Current Price string is running into your operator, and other numerous problems with this. Fix your "", throughout this line

Member Avatar for SeePlusPlus2
0
200
Member Avatar for zach&kody

What is supposed to be "written underneath" is whatever code is necessary to make the method perform as you intend. E.g. If you want the method to return the sum of 2 numbers: [CODE] public int add(int num1, int num2) { int sum=0; sum = num1+ num2; return sum; } …

Member Avatar for zach&kody
0
6K
Member Avatar for joeyn
Member Avatar for Akill10
0
126
Member Avatar for Newskin01

I'm not 100% sure what you are asking, but if you loop through your array, can you not check if an index is null, and if it is, ignore it? [CODE]for(int i=0;i<array.length,i++) { if(array[i]!=null) System.out.println(array[i]); } [/CODE]

Member Avatar for jon.kiparsky
0
2K
Member Avatar for Poopster01

I do not understand your whole coding. How can it possibly work? 1. You have multiple declarations of the same varaibles, but with different types. i.e. int index1, int index2, String index1, String index2 2. You are trying to compare a String to an int. Which is not possible. while(Name!=Sentinel) …

Member Avatar for Akill10
-1
326
Member Avatar for eikal

If you read the API docs for the Scanner class, you will see: Scanner's nextLine method "advances this scanner past the current line and returns the input that was skipped." Just replace nextLine() with next()

Member Avatar for ztini
0
153
Member Avatar for yukikazemedia

This would be much easier for you if you use objects(create a student class). Then you can store all of your info in a single array, like masijade had suggested. [CODE]public class Student { ID; name; course; address school; public Student(ID,name,course,address,school) { } }[/CODE] [url]http://download.oracle.com/javase/tutorial/java/javaOO/[/url]

Member Avatar for javaAddict
0
189
Member Avatar for Akill10

Hi, I am writing this template Array class. I am trying out some different functions, anything I can think of to implement. I have written an Add function as follows: [CODE] /**Add function - adds an element at the top of the stack**/ //creates new Array 1 larger //sets position …

Member Avatar for Akill10
0
223
Member Avatar for caltech

while(numb<=60)//means run this code while numb is in the range numb -> 60 inclusive Your increment numb by 2 everytime the loop runs. Therefore, once it reaches 60, and it will because you included it in your range, it will run again and therefore numb will be 62. What do …

Member Avatar for rxlim
0
135
Member Avatar for 20pav08

To add to what jon.kiparsky said, you will then need to create an instance of the class that contains the method you require: [CODE]FirstClass first = new FirstClass();[/CODE] inside the class you want to use it in, then call that method using the Class.getTextFromTextField1() syntax, where Class is the name …

Member Avatar for Akill10
0
103
Member Avatar for JavaHelpNeed

This is the Java section. Also, post your code in CODE-tags. Also, include the problem you are having plus any errors that you receive. You also haven't stated what a "Love Program" is, what is its purpose? Is it doing what you want?

Member Avatar for javaAddict
0
305
Member Avatar for banks2140

You are trying to use a java keyword as a variable name. Scanner new = new Scanner() does not make any sense. new is a java keyword. Change the variable name to something else. Here is a list of keywords which cannot be used as variable names [url]http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html[/url] Also, [CODE] …

Member Avatar for jon.kiparsky
0
612
Member Avatar for nallasivam25

Most probably because your screen is updating much slower than you can move the mouse. How often is your screen "redrawing"?

Member Avatar for JamesCherrill
0
347
Member Avatar for bagichris

On this line: [CODE] System.out.println("Key msg:" +setKey);[/CODE] Don't you mean: [CODE] System.out.println("Key msg:" +getKey());[/CODE]

Member Avatar for Akill10
0
153
Member Avatar for haribasker
Member Avatar for masijade
0
8K
Member Avatar for i.ibrahem

[QUOTE=peter_budo;1466229]Do not forget to reference it in your report before you submit it...[/QUOTE] I have no idea why I was so amused by this!

Member Avatar for Akill10
0
249
Member Avatar for stroper

You can use the System.exit(0); function. It takes an int as an argument, and terminates the currently running JVM. [url]http://download.oracle.com/javase/1.4.2/docs/api/java/lang/System.html[/url]

Member Avatar for stroper
0
129
Member Avatar for c++probeginner

Well, if you put the call to displayData inside your input after your loop, then that part will work fine. You are getting the warning because you have no default return value. Just put return 0; at the bottom of your function.

Member Avatar for kimmyfufu
0
192
Member Avatar for rcmango

Maybe this will help you [url]http://homepages.gac.edu/~mc38/2001J/documentation/g++.html[/url]

Member Avatar for Akill10
0
118
Member Avatar for Rimojenkins

Ok, is this how your logic should read? [I]if the value of begllts is less than or equal to the value[m] inside the array [B]and[/B] the value of the position m of the array is less than or equal to the value of endllts, then do this{}[/I] Is that what …

Member Avatar for Saith
0
122
Member Avatar for coco24

What is the second for loop for? You want to check if the value is found in the contents, so once you make the check [CODE]if (contents[i] == theValue)[/CODE] Then you should return true inside that. Then, at the end of your method, just return false(will mean the if statement …

Member Avatar for VernonDozier
0
2K
Member Avatar for kukuruku

It is because you are passing it to your setName() method without actually taking a value! Try storing input.nextLine() in a separate String variable first. Then pass that new variable which contains the input into your setName method!

Member Avatar for Akill10
0
284
Member Avatar for Nathan Campos

String test = null? If you want to create an empty string use String test = ""; Not sure if that's where your problem lies. [CODE]textField.getString()[/CODE] Is this a JTextField?

Member Avatar for jon.kiparsky
0
202
Member Avatar for Beschatten

The reason for your boolean errors is you need to compare 2 values on each condition. Meaning, you can't have a condition such as: 65 < age >= 21. You are trying to compare age to 2 different numbers to one number at the same time. You need to separate …

Member Avatar for jon.kiparsky
0
123
Member Avatar for xdrnpcx

What was your meaning when writing these lines? [CODE] myA = new int[250]; myA[0] = 50; myA[1] = 50; myA[2] = 50; myA[3] = 50; myA[4] = 50; [/CODE]

Member Avatar for xdrnpcx
0
163
Member Avatar for EmbeddedHelp

Well, string1.length returns the length of the string yes? lets say you enter: hello The length is 5(there are 5 letters). But, if you count the number of letters starting from 0, you get: 0,1,2,3,4... As you can see, even though there are 5 numbers here, the last number is …

Member Avatar for EmbeddedHelp
0
96
Member Avatar for bartm669

> Hi stultuske, > > While I appreciate your enthusiasm towards the rules of this website, perhaps you should actually read them: http://www.daniweb.com/forums/faq.php?faq=daniweb_policies Keep It Pleasant Do not post anything with malicious intent against another member, including, but not limited to, racist, sexist or religiously prejudiced remarks Do not post …

Member Avatar for bartm669
0
136
Member Avatar for Zabzacon

[QUOTE][B]I'm not sure how to make a wall that cannot be passed through, could anyone help me? [/B][/QUOTE] There are different ways to use collision detection, but a basic way, using rectangles, is to use the rectangles bounds and position on screen. And make a check as to whether any …

Member Avatar for Zabzacon
0
157
Member Avatar for lancevo3

Using your old code, replace: [CODE]if (padding == "r") System.out.println(costRegPad); else if (padding == "d") System.out.println(costDlxPad); [/CODE] with [CODE]if (padding.equals("r")) System.out.println(costRegPad); else if (padding.equals("d")) System.out.println(costDlxPad);[/CODE] To compare Strings you use .equals

Member Avatar for lancevo3
0
144
Member Avatar for chipsch

Yes, what you are doing there is creating an array [I]where you can place 5 [B]employee objects[/B][/I]. To fill your array you will need to loop through it, adding a new Employee() and asking for input with relevant paramaters in its constructor each time.

Member Avatar for chipsch
0
179

The End.