2,827 Posted Topics

Member Avatar for Phan

[QUOTE=Phan;548281]Our teacher hasn't taught us anything else about the different header files and such, so I am only using what I know. Furthermore, he told us we can use void main and return; instead of return 0;. If I take out the comas, will the if statements check the entered …

Member Avatar for Phan
0
119
Member Avatar for ckins

So you want to do something like this? [code] eeeeeeeeeeeeeeeee e e e e e e eeeeeeeeeeeeeeeee [/code] but don't know how? Or you want this? [code] eeeeeee e e e e e e eeeeeee [/code] but it ends up like this? [code] eeeeeee eee eee eeeeeee [/code] Can you …

Member Avatar for VernonDozier
0
335
Member Avatar for msaenz

[QUOTE=msaenz;546495]Getting this error don't understand really what i need to do to trouble shoot... hw.c: In function ‘PrintMatrix’: hw.c:14: error: subscripted value is neither array nor pointer hw.c: In function ‘main’: hw.c:27: warning: passing argument 1 of ‘PrintMatrix’ makes integer from pointer without a cast [ICODE] #include <stdio.h> #include <pthread.h> …

Member Avatar for WaltP
0
111
Member Avatar for sfurlow2

[QUOTE=sfurlow2;546435]If I wanted to do the same thing, only print the highest and lowest value, what would I have to do differently?[/QUOTE] Same logic. Adding code to find the lowest doesn't change anything you've done already. See my comments in the code. [code=C++] #include <iostream> //needed for cout and cin …

Member Avatar for sfurlow2
0
469
Member Avatar for orcboyx

I posted this example in a different thread earlier today. It might be of interest to you as it uses "sleep". [url]http://www.daniweb.com/forums/post546177-11.html[/url]

Member Avatar for VernonDozier
0
91
Member Avatar for eleonora

I started to reply yesterday, then decided I would wait to see if someone more knowledgeable replied first since I have not used StringTokenizer much, so code that looks a little odd to me might in fact be correct and I didn't want to say something that may work would …

Member Avatar for eleonora
0
227
Member Avatar for gallantmon1

I tried to test out your code but was unable to because you have not posted the ButtonFrame class code: [code] public static void main(String args[]) throws Exception { ButtonFrame buttonFrame = new ButtonFrame(); buttonFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); buttonFrame.setSize(275, 75); buttonFrame.setVisible(true); } [/code]

Member Avatar for gallantmon1
0
147
Member Avatar for Shveetis

[QUOTE=Shveetis;544786]Is it possible to set the value of a JTextfield in a class in which the textfield is not declared or created..?? How can one do that??[/QUOTE] I would imagine it would depend on whether the JTextfield was declared as a public or private class member. If it was declared …

Member Avatar for Shveetis
0
144
Member Avatar for nurulshidanoni

Don't reinvent the wheel. You already have a struct that works and you already have a successful method of reading the file into the data. See Post # 1 of this thread. You may want to do all sorts of stuff with that data, and in doing so, you may …

Member Avatar for nurulshidanoni
0
374
Member Avatar for Danii

Not sure what you mean by "if then loop". "if" statements aren't loops. You only go through them once. What are you asking precisely?

Member Avatar for VernonDozier
0
102
Member Avatar for Spartan552

[code] (A & 0xFF) [/code] I believe that this is a bitwise AND operation between the values A and 0xFF. 0xFF would be hexadecimal for all 1's. So let's say that A = 35, or 0x23. In binary, A is this: [code] 00100011 [/code] So you'd have: [code] 00100011 & …

Member Avatar for bugmenot
0
224
Member Avatar for 88omar

[QUOTE=88omar;542678] Write a c-program to read 10 numbers from the keyboard and store the numbers in an array called numbers After storing the numbers in the array do the following: [/QUOTE] You're in the wrong forum. This the C++ forum, not the C-forum.

Member Avatar for Google Spider
0
200
Member Avatar for kahn1

What problems are you having? Also, if you copy your code and paste them within code tags: [noparse] [code=cplusplus] // your code pasted here [/code] [/noparse] or [noparse] [code] // your code pasted here [/code] [/noparse] it is easier to read.

Member Avatar for JohnKnox
0
100
Member Avatar for 31N513N

You don't need to sort. Just declare an array of 5 integers and declare an integer called "largest" and an integer called "smallest". Start with element 0. Assign "largest" "and smallest" to that value. Then go through the other 4 integers one at a time. Compare each integer in the …

Member Avatar for JRM
0
111
Member Avatar for arun.gerrard

A byte is 8 bits. It can hold values from 0 to 255. If you try to store 256, that's the same as storing 0. 273 = 0x111. The "byte" is the last two hex digits , or 0x11, which is 17 in decimal. The leading 1 is not stored …

Member Avatar for arun.gerrard
0
87
Member Avatar for 88omar

You have "void main" instead of "int main" on line 9, my compiler complained about the word "Do" on line 19 (should be lowercase - "do"), there is no "year" in your struct in line 26, and why do you have so many parentheses in your if statement in line …

Member Avatar for prushik
0
150
Member Avatar for Jboy05

[QUOTE=Jboy05;542798]is this right anybody, please i need a solution [code] Get_inputs ( int &a, int &b, int&c) { cout <<"Enter three integers "<<endl; cin << a,b,c; system ("PAUSE"); return 0; } Get_inputs (x,y,z) [/code][/QUOTE] It's right in some ways, wrong in others. It's right in that you have a decent …

Member Avatar for Jboy05
0
105
Member Avatar for The Dude

[QUOTE=Ancient Dragon;541533]IMO she wasked for it because she refused the cop's orders to peacefully sit in that chair. Had she set there and shut up nothing probably would have happened to her. They didn't show the actual beating so we can't say what happened. [/QUOTE] I think that is part …

Member Avatar for ZZucker
0
129
Member Avatar for cosmos22

Not sure I completely understand what you are after. You want the program to run and have a console window open? The console window is open, but closes too soon? You don't want any console window to pop up ever, even when the program is running? If the last is …

Member Avatar for VernonDozier
0
100
Member Avatar for knight fyre

I looked at the table you created. I think I sort of understand what you are doing with that table, but I think making a key within the table would help make it more obvious. You have five columns: a) Potential Object/Class b) General Classification c) Accept categories d) Reject …

Member Avatar for VernonDozier
0
68
Member Avatar for Techboy52

[QUOTE=Techboy52;542169] [code] case:('0'); //illegal start of expression and not a statement [/code] [/QUOTE] Try changing the above line to: [code] case '0': [/code]

Member Avatar for Techboy52
0
477
Member Avatar for deifyme

What kind of file is it? Are you reading data from a data file and the Java program can't find the data file? Or is it some class file it can't find? From your description it sounds like the former. I assume this is a run time error rather than …

Member Avatar for deifyme
0
174
Member Avatar for leroi green

I believe you have these SwingConstants backwards in the two lines below. I ran your code through NetBeans and it gave me exceptions on these lines: [code] label1.setVerticalTextPosition(SwingConstants.LEFT); label1.setHorizontalTextPosition(SwingConstants.TOP); [/code] Swapping the positions of LEFT and TOP in the above lines got me farther in the code. TOP goes with …

Member Avatar for leroi green
0
102
Member Avatar for williamku87
Member Avatar for tomeagle

I added an ending bracket after "return 0" and ran your code and it ran to completion. I didn't get any run-time error.

Member Avatar for VernonDozier
0
216
Member Avatar for Roebuc

When you read in the character into answer, you are actually reading in two characters. The first character is 'y', the second character is '\n'. The 'y' is grabbed and stuck into the variable answer. That leaves the '\n' still in that buffer. Next comes the getline command. Let's pretend …

Member Avatar for Roebuc
0
586
Member Avatar for arby11886

[QUOTE=arby11886;539157] questions: I'm still having issues with the strmcpy. Typically I have problems with someone and then I figure it out later on. Right now, I'm wondering if I should use what I have for strmcpy or if I should use the variable names instead. (int ln = strcmp(lname, r.lname); …

Member Avatar for mitrmkar
0
182
Member Avatar for Jiko980
Member Avatar for alejalv

You might want to post the entire program so we can get a better handle on it, if it's not too huge.

Member Avatar for VernonDozier
0
177
Member Avatar for Noliving

You have some problems with your "toString" function: [code=JAVA] public String toString() { return "The Colors: " + Color + "\n" + "The weight: " + Weight + "\n" + "boolean: " + boolean + "\n"; } [/code] One, you are using the word "Color" which has meaning in Java, …

Member Avatar for Noliving
0
229
Member Avatar for Jboy05

The function is going to take two parameters regardless of whether you pass by reference or by value. Regardless of whether you pass the salary by reference or value, I would pass the increase by value since you shouldn't change it. I would return a double if it was passed …

Member Avatar for VernonDozier
0
81
Member Avatar for griproller

You don't need anywhere near this many lines to convert from hex to binary. I would convert from a hex character to an integer from 0 to 15, then just do this: [code=C++] int hexValue; // code to put a number from 0 to 15 into hexValue; values[4 * i] …

Member Avatar for griproller
0
105
Member Avatar for stlmac

You have not ended your switch statement in main with a closing bracket so the compiler doesn't know where it ends.

Member Avatar for stlmac
0
119
Member Avatar for jenna_baby

You are going to have to keep at least one running tally: the number of daytime minutes. You should initialize this to 0 before your while loop starts. When you decide that a call is a daytime call, you'll increment this variable (let's call it numDaytimeMinutes) by the number of …

Member Avatar for ithelp
1
96
Member Avatar for smiles

[code=C] int *keyPressed; //change here ... play: keyPressed=OnRelease(); if(keyPressed != NULL) { WrDat2Lcd(*keyPressed); //..and here ??? } goto play; int OnRelease() // returns an integer, not an int* [/code] Function OnRelease returns an integer. keyPressed is type int*. You are assigning an integer value to an int* variable in line …

Member Avatar for VernonDozier
0
106
Member Avatar for BBallAsh23

I got an endless loop of this: [code] The position of cell is (row, col): [/code] What am I supposed to get?

Member Avatar for BBallAsh23
0
133
Member Avatar for karinmorena

Not sure if you know this but you can use Java-specific code tags, so this [code] public void setResultValue(int i) { double monthlyPayment, monthlyInterest, denominator, numOfMonths, getMortgageAmount,MortgageInfo ; double[] annualInterests = {5.35,5.5,5.75}; //Interest Array int[] numOfYears = {7,15,30}; //Term Array double principal = Double.parseDouble(mortgageText.getText()); double term = Double.parseDouble(termText.getText()); double interest …

Member Avatar for karinmorena
0
332
Member Avatar for cj-read

[QUOTE=cj-read;538588] I want to read the file in and sort column 5 relative to column 1. [/QUOTE] I'm not sure I understand what this sentence means as it pertains to your example below: [QUOTE=cj-read;538588] i.e. 1,b,1.11,2.22,3.33,200.00 3,c,1.11,2.22,3.33,100.00 becomes 3,c,1.11,2.22,3.33,100.00 1,b,1.11,2.22,3.33,200.00 etc. [/QUOTE] You have six columns, not 5, and you …

Member Avatar for vmanes
0
270
Member Avatar for carnage

Question: Does the user buy one item or three items? It appears that the user buys three items. Regardless it looks like you are trying to allocate one character to store "Quadcore". This is not going to work. I think you want to work with strings. You'll have to decide …

Member Avatar for carnage
0
136
Member Avatar for Javaman31

Can you be more specific as to what the problems are? "Messed up" isn't very descriptive.

Member Avatar for stultuske
0
94
Member Avatar for number87

[QUOTE=number87;538160]:icon_eek: i just realised i got my definition of a rational number wrong...rational number is in the form n = a/b. i dont think c++ has a way of displaying a number in such a form right? [/QUOTE] I don't think there is a method in the C++ Standard. I …

Member Avatar for DangerDev
0
103
Member Avatar for lord12

Neither 11 nor 110 is a legal word in your word set of {01, 10, 011} so neither 11-011 nor 110-11 are legal messages. Am I misunderstanding the rules?

Member Avatar for VernonDozier
0
194
Member Avatar for brinze

Looks like you tried to add this function inside of your main function. You want it OUTSIDE of main, like this: [code=JAVA] public class Dice { private int diceRoll() { double r=Math.Random(); //do stuff return /* An int number between 1 and 6 */ } public static void main (String[] …

Member Avatar for brinze
0
141
Member Avatar for knight fyre

I ran your program. It compiled and ran without errors (i.e. ran to completion). Regarding the fact that the issue and expiration dates are not displayed, I don't see anywhere where you are telling the computer to display that information. At the end of driver.cpp you have these lines: [code=C++] …

Member Avatar for knight fyre
0
144
Member Avatar for curt1203

Check out this link on how to do it (I'm linking rather than showing you myself because I myself haven't figured out how to make it display the words "code=C++" and "/code" as text without it getting interpreted as code). [url]http://www.daniweb.com/forums/post535004-2.html[/url]

Member Avatar for curt1203
0
250
Member Avatar for sonygamer

Your integer value is probably overflowing. An integer can only hold up to 2^31 -1, which is somewhere in the neighborhood of 2 billion. It can't store anything above that. If you change everything to unsigned integers you can get double that, or around 4 billion. I don't know of …

Member Avatar for Arpy Giri
0
295
Member Avatar for Crazycfk

Are you guys in the same class or something? [url]http://www.daniweb.com/forums/thread109291.html[/url] [url]http://www.daniweb.com/forums/thread109297.html[/url]

Member Avatar for Crazycfk
0
159
Member Avatar for kpp003

What problem(s) are you having? What is it not doing that you intend it to do? What does it do that you don't want it to do? What works? Please be more specific.

Member Avatar for VernonDozier
0
85
Member Avatar for T-Mac1

Well there a bunch of ways to do it. Are you typing in each employee's hours and wage rate or are you reading from a file? Are you collecting and storing each employee's data, then immediately figuring out the math and displaying it, or do you need to store all …

Member Avatar for VernonDozier
0
913
Member Avatar for saketbash

I don't know. Two guesses. One, five characters per column: [code] 87 54 32 12 13 100 3 12 100 2 [/code] Each column takes up five spaces, total of 50 spaces per line. Second guess. Group 5 rows together: [code] 87 54 32 12 13 100 3 12 100 …

Member Avatar for saketbash
0
167

The End.