2,827 Posted Topics
Re: [QUOTE=Alex Edwards;703258]I had a hard time understanding the concept of memory in a computer, but something my Instructor told me gave me some hope. He mentioned that memory isn't really created upon invocation of "new" in C++, and stated also that memory isn't really removed upon the invocation of "delete." … | |
Re: Well you need to place some debugging statements in your code or use a debugger and add some breakpoints, or both. You need to decide exactly what each function is SUPPOSED to do, then decide whether it is actually doing it. You can add a bunch of cout statements (which … | |
Re: [code=cplusplus] for (int i = 0; ar2[i] != ' '; i++) { char strA[99]; strcpy_s(strA, str); cout<<"Your sentence without spaces is "<<strA<<endl; } [/code] Line 1 - That loop condition won't work. It stops your loop at the first blank. Line 3 - Array declaration needs to come BEFORE the … | |
Re: [QUOTE=teh noobshow;702339]My way of coding is more simpler than the public boolean and public void... [/quote] Yes, you mentioned your disdain for public void and public boolean in this thread. I can't stand them either. [url]http://www.daniweb.com/forums/thread139990.html[/url] [QUOTE=teh noobshow;702339] So thinking smart i decided to make everything different. Instead of long … | |
Re: Code tags and formatting please. It's too hard to read otherwise: [noparse] [code] // paste code here [/code] [/noparse] [code] System.out.println("Your third roll was "+ aRandomNumber +". Do you want" +" to change your guess?"); [/code] [ICODE]aRandomNumber[/ICODE] is an integer. You need to convert it to a String with [ICODE]toString[/ICODE] … | |
Re: You can add a few blank Jabels. Make the GridLayout 5 x 5. You'll have 21 items to add. Top row is two blank JLabels, then the screen, then two more blank labels. The next four rows will be buttons. The last four spots are vacant. The screen would be … | |
We have a stickie on top of a lot of the forums with good websites/books, etc. I figured I'd share one I just discovered. I decided to test my C++ knowledge and so I took this [URL="http://www.academictutorials.com/quiz.asp?id=56"]quiz[/URL] and didn't do too hot. But I don't feel too bad and if … | |
Re: [QUOTE=Kplusplus;697377]Okay! After a bit of research and combining the two methods here is what i've come up with so far: [ICODE]#include <iostream> #include <string> #include <fstream> using namespace std; int main (){ string name; string address; int phone; string city; string country; string line; // Beging creation of file. std::string … | |
Re: One, use code tags and formatting. Way too much code to look at without code tags, formatting, line numbers: [noparse] [code=cplusplus] // paste code here [/code] [/noparse] Two, don't just paste a bunch of code up. What's the question? Does it compile? Does it run? Does it crash? What's the … | |
Re: [QUOTE=countrygirl1970;699911]Hello, I am trying to get my cost, salestax, totalamount to come out in the output dialogbox to have only two decimals places. I know how to do on the printf but not on the dialogbox. Please help. Here in my complete code. [code] // Displaying multiple strings import javax.swing.*; … | |
Re: [QUOTE=ohnomis;700614]Maybe you can simply explain what your T, n and x represent? From what I see, x is the value the user inputs and I have no idea where your n comes from. Like in your formula, the most I can see is: cin << x; n = ? T … | |
Re: [QUOTE=blue_moon;700650]Write a method that converts its String parameter so that letters are written in blocks five letters long. For example, consider the following two versions of the same sentence: Plain: This is how we would ordinarily write a sentence. Blocked : Thisi showw ewoul dordi naril ywrit easen tence p.s....still … | |
Re: [QUOTE=MNR;701039]i have two classes one is MyForm and the other one is MySwingWorker, i get a null exception which is related to line 36, i'm not sure what i have to pass to MySwingWorker class. please help!!!! [CODE=java]public class MyForm extends JFrame { public static void main(String[] args) { new … | |
Re: I think we really ought to go back to the basics. Paper ballot and you vote at the precinct. Way too many absentee ballots. We need a real ID that can be verified. I hate the idea of voting by phone or internet. It's just too easy to commit massive … | |
I've been experimenting around with the [ICODE]const[/ICODE] modifier, trying to make sure I understand it and clearly I do not. I wrote this program. Note line 28, where I am changing the value of the parameter passed to a copy constructor, and the word [ICODE]const[/ICODE] on line 40: [code=cplusplus] #include … | |
Re: [QUOTE=gregorynoob;700047]a simple loop? could you please tell me what algorithm would that be? cause recursion would go O(n!), would have to check all the combinations, also i didn't say, there are no unlimited supplies of items like in usual knapsack.[/QUOTE] O (n!) when using recursion? I either don't understand the … | |
Re: [QUOTE=bodomchild;700262]Actually I spent hours on it and nothing :/ I didn't quiet understand what you said last but i tried what you said, I tried to explain the problem logically, but nothing :/ I think I'm supposed to use a "DO WHILE" loop or a "For" loop, so says my … | |
Re: It's impossible to read without code tags and formatting: [noparse] [code] // paste code here [/code] [/noparse] You have some stray brackets in there, which I assume is an attempt to post with code tags, but I'm not sure. If they are in the code itself, delete them. Start by … | |
Re: [QUOTE=san_sarangkar;699900]no man I am talking about execution. In above case first main will execute and then my_init_func() will be called.I dont want that. See in following case int main() { cout<<"In main"<<endl; } my_function() { cout<<"In my function"; } O/P should be: In my function In main[/QUOTE] Duoas was talking … | |
Re: [QUOTE=unk45;699693]i know my code is pretty pathetic so far..but dont plan on majoring in computer sci..its just an engineering req..got 2 weeks left till end of class[/QUOTE] Why bother to tell us this? You have to take all sorts of classes that aren't in your major. Presumably someone in the … | |
Re: [QUOTE=janustt;698443]What does that do?[/QUOTE] That isn't a helpful response. "What does that do?" could mean several things, as could the word "that". Do you not understand why masijade suggested two FileOutputStreams? Do you not understand why he suggested to use parseInt? Do you not know how to use them? Etc. … | |
Re: [QUOTE=clueless101;697538]This program is suppose to allow the user to enter a student's name and (4) scores via GUI, instead of Scanner class. The class is to use a String array for 5 names, an array of 5 characters to hold letter grades, and 5 arrays of four doubles for each … | |
Re: One, if you aren't required to do it using Swing, do a console program, in my opinion. You're already outputting to console anyway. Two, use better names for your classes and variables. It's really hard to follow. [ICODE]test[/ICODE]? [ICODE]tracker[/ICODE]? names is of type [ICODE]Candidate[/ICODE]? I'd get rid of the Vote … | |
Re: [QUOTE=chern4ever;698184]thanks for the help! is there any to not show the remainder of a division?[/QUOTE] Yes. If you want a better answer, you are going to have to ask a more precise question. | |
Re: [QUOTE=iamthwee;698949]Well then the code you posted above is wrong, or you posted the wrong one by accident.[/QUOTE] Yes, the code you posted would not compile anywhere. You don't define [ICODE]nom[/ICODE] . Copy and paste the code you posted verbatim and try compiling it again. ![]() | |
Re: [QUOTE=sanfan49er;698870]so its not working need help again[/QUOTE] Well your code has obviously changed since you last posted, so post the updated code with a description of the problem you now are having and the exact error message. Please post formatted code and use code tags. [noparse] [code] // paste code … | |
Re: [QUOTE=TheMoosiah;698792]Would I require something along the lines of the following? I tried only entering the part for x to try it out, and I get a "parse error before character constant" in the first line, so I can't run it. if 'A' in x: n = 1 elif 'K' in … | |
Re: [QUOTE=dnmoore;698333]well thats how i always wrote my pseudocode, i also posted the java code i have so far i had a very bad java teacher in the past and thats why im retaking it now and thats why i dont understand the most simpliest stuff[/QUOTE] Before you think about Java, … | |
Re: [QUOTE=adiel224;697636]public void update(....){ //complete here .....[/QUOTE] Awesome! Normally I give negative rep for posts like these where the OP just wants you to do all the work for him/her, but adiel224 hasn't even bothered to cut and paste the assignment verbatim, so I couldn't even do the whole thing if … | |
Re: [QUOTE=BlackNinja;697502]hi im new to java and just need a little help in the right direction. I am trying to display an input of int on number at a time. So for example the user would enter 1998 and the output would be: 1 9 9 8 and we have to … | |
Re: [QUOTE=MylesDBaker;697555]I thought so too. I tried removing them, but the program would not work without having them there. Is there something I can do to avoid using them? Without them I get the else statement after every output.[/QUOTE] You can change your if statements to a switch statement when you … | |
Re: [QUOTE=Dannielf;697621]ok, so I just started looping today and the simpler programs are all right, but we got a pretty complex assignment which I am pretty lost on. here's the assignment: [I]Write a program that updates a person’s bank balance based on withdrawals and deposits. Ask the user to enter the … | |
Re: [QUOTE=bbhe;696171]Hi, I am trying to replace a few text strings in a text file (test.txt), and then makeing some spaces, for it to be easier to read Anyone have an example I can use, because I am new to C++ I just want to replace "word1" with red "word2", and … | |
Re: Too vague. What are you trying to authenticate? Are there user accounts and you are checking user names and passwords? Asking the user questions he/she should know and checking them against a database? Something different? | |
Re: [QUOTE=intelli;696913]i have to write a simple java program write an application that determines the value of coins in a jar and prints the total in dollars and cents. Read integer values that represent the number of quarters, dimes, nickels and pennies so i did it i don't know where to … | |
Re: [QUOTE=defychaos;696907]Hi friends :P I'm needing some help on an assignment. I'm really not sure about all the argument-passing and structure references I have been assigned for my C++ class. Any help is greatly appreciated. I'll continue to work on it in the meantime, but I cannot get it to compile … | |
Re: [QUOTE=Trekker182;696924]I'm taking the time from an accessor function and if it's from 0-9, so it displays correctly the hour time position, I have the following statements in my main body: [CODE] if (clock1.getHour() == 00) cout<<"The hour of clock1 is 00"<<endl; else if (clock1.getHour() == 01) cout<<"The hour of clock1 … | |
Re: [QUOTE=tanha;696963]Hi. I am using netBeans 6.1 on windows XP, and when I create a java class and I create a frame inside that class? why I can not see the design of that class? I mean why I can not see the frame and also the control like buttons, text, … | |
Re: You need to add the red text below: [code] public class Walking extends Applet [COLOR="Red"]implements ActionListener[/COLOR] [/code] | |
Re: [QUOTE=pads;695770]Customer and Pensioner. Pensioner should be a subclass of Customer. These classes should be in their own files with separate header files. Details are below. Create a third class called Manager. The manager file can contain the main function. The Manager class should contain member functions that read a text … | |
Re: Use code tags and things will space out nicely. Spacing is retained when you use code tags: [noparse] [code] // paste formatted code or output here [/code] [/noparse] [code] 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 [/code] Keep in mind that this … | |
Re: [QUOTE=san_sarangkar;696283]I want some logic to shuffle numbers from array if a[5]={1,4,3,7,5,} then after shuffling 1,4,3,7,5 should be in any other order please help[/QUOTE] You need to generate random numbers covering all indexes such that each index is generated one time and only one time. In other words you need to … | |
Re: [QUOTE=Trekker182;696290]This is the first time I'm trying to compile code that I've written using a main program file, a .h file and a .cpp implementation file. I'm using Dev C++ 4.9.9.2 and when I try to compile my main.cpp file, I get several errors of this sort. 1 F:\COP1335C\LAB#3\Time.cpp In … | |
Re: [QUOTE=meddlepal;695773]I have a file with a network map consisting of 0's and 1's. I want to read this map into a two-dimensional array. I have the following code: [CODE] #include <iostream> #include <fstream> using namespace std; int main() { char map[22][22]; // 22 x 22 (r*c) ifstream fin; fin.open("netmap.txt"); char … | |
Re: Your function declaration: [code] void get_pay(float wage, float hours) [/code] and your function implementation: [code] void get_pay(float& wage, float& hours) [/code] need to match. Please format and use code tags. [noparse] [code] // paste code here [/code] [/noparse] | |
Re: [QUOTE=melissajohn718;695881]I got this error message: error C2447: '{' : missing function header (old-style formal list?) What does it mean? How can I fix this? Please let me know. Thank you! I started with... #include <iostream> using namespace std; int num; { and then i added my variables...[/QUOTE] I can't think … | |
Re: [QUOTE=nitric0;695832]hey guys new here and i'm also new to JAVA. i'm taking a class and am kind of stumped in my first assignment i basically have to write a program that will give the total due a user using an internet cafe. each full hour = $5.00 each m inute … | |
Re: [QUOTE=llemes4011;695173]. . . ok... slightly less confused... but how would i add a coordinate point to the array?[/QUOTE] From the above example, if you wanted to "add" the points (5, 7) and (8, 9), you could do this: [code] lotsOfSquares[0] = new Square (5, 7); lotsOfSquares[1] = new Square (8, … | |
Re: Here's a good link from Narue on many sorts, including the Insertion Sort. Go about 1/3 of the way down to find the Insertion Sort segment. It's an efficient sort on data that's mostly sorted already, but not so great for random lists. Narue explains on the link. An array … | |
Re: [QUOTE=Aia;694560]What did you not like, the sugar or the puddin'? Oh, and I am not Dave. How sweet that you're thinking of him. Funny, I never felt superior to anyone, and never even hinted to it. However, I know someone that works in that frame of mind. Do you remember … |
The End.