2,827 Posted Topics
Re: [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 … | |
Re: 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 … | |
Re: [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> … | |
Re: [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 … | |
Re: 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] | |
Re: 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 … | |
Re: 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] | |
Re: [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 … | |
Re: 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 … | |
Re: 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? | |
Re: [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 & … | |
Re: [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. | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: [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 … | |
Re: [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 … | |
Re: 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 … | |
Re: 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 … | |
Re: [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] | |
Re: 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 … | |
Re: 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 … | |
Re: [noparse] [code] // your code here [/code] [/noparse] | |
Re: 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. | |
Re: 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 … | |
Re: [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); … | |
Re: Can you give us a short example of input and correct output? | |
Re: You might want to post the entire program so we can get a better handle on it, if it's not too huge. | |
Re: 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, … | |
Re: 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 … | |
Re: 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] … | |
Re: You have not ended your switch statement in main with a closing bracket so the compiler doesn't know where it ends. | |
Re: 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 … | |
Re: [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 … | |
Re: I got an endless loop of this: [code] The position of cell is (row, col): [/code] What am I supposed to get? | |
Re: 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 … | |
Re: [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 … | |
Re: 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 … | |
Re: Can you be more specific as to what the problems are? "Messed up" isn't very descriptive. | |
Re: [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 … | |
Re: 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? | |
Re: 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[] … | |
Re: 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++] … | |
Re: 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] | |
Re: 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 … | |
Re: 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] | |
Re: 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. | |
Re: 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 … | |
Re: 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 … |
The End.