2,827 Posted Topics

Member Avatar for Alex Edwards

[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." …

Member Avatar for skatamatic
0
169
Member Avatar for NinjaLink

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 …

Member Avatar for NinjaLink
0
164
Member Avatar for unk45

[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 …

Member Avatar for unk45
0
275
Member Avatar for teh noobshow

[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 …

Member Avatar for javaAddict
-1
100
Member Avatar for JQuinn88

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] …

Member Avatar for kjduke
0
142
Member Avatar for 2o2

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 …

Member Avatar for VernonDozier
0
3K
Member Avatar for VernonDozier

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 …

Member Avatar for VernonDozier
1
162
Member Avatar for Kplusplus

[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 …

Member Avatar for VernonDozier
0
933
Member Avatar for Bigboy06

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 …

Member Avatar for Salem
0
144
Member Avatar for countrygirl1970

[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.*; …

Member Avatar for countrygirl1970
0
243
Member Avatar for ohnomis

[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 …

Member Avatar for ohnomis
0
534
Member Avatar for blue_moon

[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 …

Member Avatar for stultuske
0
286
Member Avatar for MNR

[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 …

Member Avatar for MNR
0
106
Member Avatar for zeroth

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 …

Member Avatar for Dave Sinkula
1
185
Member Avatar for VernonDozier

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 …

Member Avatar for VernonDozier
0
424
Member Avatar for gregorynoob

[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 …

Member Avatar for VernonDozier
0
272
Member Avatar for bodomchild

[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 …

Member Avatar for bodomchild
0
140
Member Avatar for Hinche4

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 …

Member Avatar for Hinche4
0
302
Member Avatar for san_sarangkar

[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 …

Member Avatar for ArkM
0
321
Member Avatar for unk45

[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 …

Member Avatar for Salem
0
693
Member Avatar for janustt

[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. …

Member Avatar for masijade
0
168
Member Avatar for clueless101

[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 …

Member Avatar for VernonDozier
0
174
Member Avatar for Darklighter201

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 …

Member Avatar for Darklighter201
0
76
Member Avatar for chern4ever

[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.

Member Avatar for chern4ever
0
329
Member Avatar for diyaz

[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.

Member Avatar for iamthwee
0
187
Member Avatar for sanfan49er

[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 …

Member Avatar for sanfan49er
0
5K
Member Avatar for TheMoosiah

[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 …

Member Avatar for VernonDozier
0
96
Member Avatar for dnmoore

[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, …

Member Avatar for stultuske
0
526
Member Avatar for adiel224

[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 …

Member Avatar for stultuske
1
85
Member Avatar for BlackNinja

[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 …

Member Avatar for Ezzaral
0
135
Member Avatar for MylesDBaker

[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 …

Member Avatar for MylesDBaker
0
152
Member Avatar for Dannielf

[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 …

Member Avatar for VernonDozier
0
162
Member Avatar for bbhe

[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 …

Member Avatar for bbhe
0
153
Member Avatar for noadek

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?

Member Avatar for Salem
0
247
Member Avatar for intelli

[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 …

Member Avatar for intelli
0
2K
Member Avatar for defychaos

[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 …

Member Avatar for skatamatic
0
120
Member Avatar for Trekker182

[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 …

Member Avatar for VernonDozier
0
4K
Member Avatar for tanha

[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, …

Member Avatar for tanha
0
117
Member Avatar for zwench

You need to add the red text below: [code] public class Walking extends Applet [COLOR="Red"]implements ActionListener[/COLOR] [/code]

Member Avatar for zwench
0
161
Member Avatar for pads

[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 …

Member Avatar for skatamatic
0
229
Member Avatar for jagdishc

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 …

Member Avatar for jagdishc
0
80
Member Avatar for san_sarangkar

[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 …

Member Avatar for VernonDozier
0
168
Member Avatar for Trekker182

[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 …

Member Avatar for Trekker182
0
173
Member Avatar for meddlepal

[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 …

Member Avatar for meddlepal
0
160
Member Avatar for c230jif

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]

Member Avatar for c230jif
0
133
Member Avatar for melissajohn718

[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 …

Member Avatar for VernonDozier
0
196
Member Avatar for nitric0

[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 …

Member Avatar for VernonDozier
0
89
Member Avatar for llemes4011

[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, …

Member Avatar for Alex Edwards
0
88
Member Avatar for swbuko

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 …

Member Avatar for stilllearning
0
236
Member Avatar for Dave Sinkula

[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 …

Member Avatar for Aia
0
420

The End.