2,827 Posted Topics
Re: [QUOTE=GrimJack;689471]There is an interesting development in Wisconsin, Michigan, and Mississippi, state Attorneys General are suing the Boards of Election to remove all voters from the rolls whose address does not match the address in the Department of Licensing db. In some of the larger cities, plans are in place to … | |
Re: Centrist Libertarian. But it was a real stretch trying to find any of the 4 options that fit my opinion sometimes, so I'm sort of taking it with a grain of salt. You mentioned it was biased. I'd never heard of the Nolan Chart before. What do you think it's … | |
Re: You are searching for a word before you have read in any words from the file. Your call to binarySearch is on line 32. You only start to read from the file on line 36. By line 36, your "search" is complete and you have already decided that the word … | |
Re: [code] System.out.println (+text); [/code] + is a concatenation operator here. You use a + to concatenate two separate things that you want to print, so you should always have something on each side of the + sign. You only have one item to print, so lose the + sign. [code] … | |
Re: [QUOTE=dmanw100;715752]I am writing a program using strings to pass messages into SDL functions. For some reason the compiler will not let me create any string objects though. I get a 'string' undeclared error when I try to compile this code: [CODE]#include "SDL/SDL.h" #include "SDL/SDL_ttf.h" #include <string> int errorMessage(int errorNumber) { … | |
Re: [QUOTE=Khae;713255]hi guys need help I resently just started c++ and on classes and have a project to print a tag to be attached on a luggage and deppending on wether the costomer want it delivered at home or pick it up at the airport. Plz find attachment[/QUOTE] I don't see … | |
Re: [QUOTE=NinjaLink;714391]I wish I could say that worked, but it didn't. o_O I tried several different ways, but I had no luck. Can anyone help please?[/QUOTE] "It didn't work" isn't helpful. You say you've tried several different ways, but we have no idea what you've tried and we don't know the … | |
Re: [QUOTE=NinjaLink;713922]I understand that I need to delete some things and make some changes, but I'm not done with the program yet. My program runs and works. I'm just trying to make this adjustment right now. I will make the further changes after I'm done. Can anyone answer my previous question … | |
Re: [code] int add() { v1 + v2 == ans; } [/code] You have the same problems for all of your functions. One, this line: [code] [COLOR="Red"]int[/COLOR] add () [/code] If the word in red above is anything but [ICODE]void[/ICODE], you need to have the keyword [ICODE]return[/ICODE] in your function. In … | |
Re: [QUOTE=chern4ever;712993]i don get this myFile >> data1 >> data2 >> data3 >> data4; can u explain in more detail? [/QUOTE] What don't you get about it? It's the same as: [code] myFile >> data1; myFile >> data2; myFile >> data3; myFile >> data4; [/code] | |
Re: He/she means that you should add cout statements at different places to help narrow down where the problem is. Figure out what the variables' values SHOULD BE at certain times, add some cout statements and make sure that what they SHOULD BE is what they are. Here is your code: … | |
Re: [QUOTE=GrimJack;709976]It is a push poll that tries to force certain answers - it pretty much sux but I agreed with Obama 71% of the time (are you surprised Dave?).[/QUOTE] Yes, and a not very well hidden one either. It has an "About the Author" page and a link to a … | |
Re: [QUOTE=IrishUpstart;712867]This is what I have so far, but I am VERY certain this does not even begin to answer the question...like at all. [CODE]#include <stdio.h> #include <stdlib.h> #include <math.h> #define TOLERANCE 0.0001 int main(void) { double x, newx, delta ; int counter = 0 ; x = 0.8 ; // … | |
Re: It's a little ambiguous what the problem is. Do you want to repeat till a -1 is entered? If so, see stilllearning's post. If the problem is that your console closes too fast to see the output and you want to keep the console open, see this thread: [url]http://www.dreamincode.net/forums/showtopic30581.htm[/url] | |
Okay, suppose I have a class A and subclasses B, C, D, E, F, G. I have a function: [code] public void foo (A object) [/code] I have the default function handler which handles A objects which aren't subclassed, and the B, C, and D subclasses. Subclasses of type E, … | |
Re: [QUOTE=Dounia;63120]:rolleyes: Hi, Could you please help?? I am tired and confused. I don't what to do any more! I am trying to write a traffic simulation and i wrote some interface and some classes but the main one that has a big chunk of code seems to me like nightmare. … | |
Re: Almost assuredly your problem is that your stack keeps changing withing the move function and situations that were intended to be caught originally in one of the higher if statements are getting PAST that point and the calls are being made assuming stacks that USED to be there, but have … | |
Re: [QUOTE=mrrko;711228]Thanks a lot, without a doubt that is my error... But I tried n > i... and it give me an infinite loop... so now I dont know what to do[/QUOTE] Well what are you TRYING to do with this loop? Go through all the numbers greater than or equal … | |
[QUOTE=schamb;711245]also am curious as to how decimal to hexidecimal would work too just wanting to learn more about programming language and am very in experewienced[/QUOTE] You are going to have to get a lot more specific on these questions. General advice: 1. Read in a number in decimal. 2. Do … | |
Re: [QUOTE=ae012;711154]i have a machine problem to do. it should compute for the average grade of N scholars. N will be entered on the keyboard and the Student No. and Grades of the Scholars in *8 Subjects will be entered. sample output of program should be like this. STUDENT NO. S1 … | |
Re: [QUOTE=defychaos;708973]Hi :) I'm doing a programming project with development of an algorithm for a quadratic recursive sequence: (3, 3, 7, 11, 19, 20, 32), but I can't figure out which expression to use. I know it's probably got something to do with the differences of n-1 and n-2 being added … | |
Re: As previously mentioned, please use code tags. All formatting is stripped out otherwise. [noparse] [code] // paste code here [/code] [/noparse] or C++-specific code tags, with line numbers and syntax highlighting: [noparse] [code=cplusplus] // paste code here [/code] [/noparse] | |
Re: [QUOTE=gregorynoob;708946]hmm, well now i've implemented it, but it's so damn slow... it should work fast for 100k atleast... here's my implementation: [code=c++]#include <cstdio> #include <cstring> #include <algorithm> #define MOD 100000 using namespace std; const int coins[] = {1, 2, 5, 25}; int n, dp[100000][5]; int rec(int n, int m) { … | |
Re: [QUOTE=ithelp;709361]Even if you do not do it as long you do not fail the course you should not worry.[/QUOTE] What a ridiculous thing to say. I certainly hope he doesn't pass the class. Not only is he too lazy to do his own work, not only does he have the … | |
Re: You're on the right track: [code=cplusplus] for(int i = (value - 1); i > 0; i--) { for (int j = 0; j < i; j++) cout << "*" << flush; cout << "" << endl; } [/code] You have a loop set up to display the asterisks. Have a … | |
Re: I think you can get rid of the outer while loop: [code] while (!isGuessed) { // code isGuessed = true; } //end while [/code] Since you assign isGuessed to true at the end, you're only going to go through the loop once, right? So it's not really a loop. Also, … | |
Re: any one who can help me hello,,im a Filipino student from Cabanatuan City Philippines.. Im just a Second year College student taking up Computer Science.. I would like to ask you something about sorting an alphanumeric character.. im just a student i would like to learn in advance programming.. can … | |
Re: [QUOTE=grisha83;708560]Hello, Here is the problem ive been working on: write a while loop that displays each int from 1 to 5 together with its square and a cube. Display all three values for integer on a separate line. My problem is that it does not really do what it is … | |
Re: Code tags and formatting are vital for problems like these. Without code tags: [noparse] [code=JAVA] // paste code here [/code] [/noparse] You'll get more help if you use code tags in the future. [code=JAVA] //Weeklypay2 import java.util.Scanner; // class Scanner public class Weeklypay2 { //main method begins execution of Java … | |
Re: [QUOTE=Newguy89;708430]the program should print 1 this one should have six spaces and then 1 22 5 spaces then 2 333 and so on 4444 sum reason when i post here it aligns left 55555 666666 though it prints... 1 22 333 4444 55555 666666 [code=cplusplus] #include <iostream> using namespace std; … | |
Re: [QUOTE=nizbit;708380]I am having a little bit of a dilemma. I have an input file that can have a number 1 through 9 or a asterisk. I am treating 1-9 as a character. I don't know if there is white space or new lines. I can't use >> because I don't … | |
Re: You can use [URL="http://www.cplusplus.com/reference/string/string/compare.html"]compare[/URL] since you are using strings rather than C-strings. Or strcmp could work, as the last poster mentioned, though you'd have to convert from strings to C-Strings. | |
Re: [QUOTE=uae_uae99;707685]hi everone ,actually i need ur helps. i have to submet my final project next week on 14/10 and i didnt star yet .therefore, i wanna star this week but i dont have enogh ideo 4 my topic (my topic is make program for sell and rant a car ) … | |
Re: Code tags please. [noparse] [code] // paste code here [/code] [/noparse] Makes things much easier to read. [code] cout << "What is the number of the top floor? "; cin >> topfloor; if (topfloor<1) cout <<"Invalid number of floors. Please try again."<<endl; [/code] You say "Please try again" here, but … | |
Re: [QUOTE=Ellisande;706865]Haha, not even a minute before you replied I found that little section both on that website and in my textbook. Thank you for the help though. The only problem I seem to have with this is it reads the lines as a string. Is there a function in <string> … | |
Re: [QUOTE=anbuninja;703854]so im working on my assignment and it says Percentage of ticket revenue which goes to administrative costs. This input will be entered in percent format (see sample runs below); your program must convert this to a decimal fraction. For example, the user enters 25% as 25, not .25; you … | |
Re: [QUOTE=BINDERJ2;706789][code]#include <iostream> #include <iomanip> #include <cstring> using namespace std; int main() { char name[40]; double date1; double date2; double date3; double h1; double h2; double h3; // Name of pole vaulter cout << "What is the name of the pole vaulter? "; cin.getline(name,40); // Month1, Vault1 cout << "What was … | |
Re: [QUOTE=jeevsmyd;706316]".H" could be avoided,right? any other other changes required??[/QUOTE] [QUOTE=bhoot_jb;706473] Also, .H files certainly cannot be avoided. [/QUOTE] I think the avoidance of .h files topic stems from an earlier post from me on a different thread. Let me clarify what I meant. You had code like this before: [code] … | |
Re: Game works great! I tested it and ended up playing it for far longer than I intended. It seems to work fine. The only thing I'd change, if you wanted to improve it, is to have some data validation, as in if users enter in illegal characters or not exactly … | |
Re: [code=cplusplus] #include <stdlib.h> #include <iostream.h> #include<conio.h> class game { public: int num,random_integer; void dispnum(); void getnum(); void result(); void playgame() { while(3) { game::dispnum(); game::getnum(); game::result(); } }; void game::dispnum() { srand((unsigned) time(0)); random_integer = rand(); cout << random_integer<< endl; } void game::getnum() { cin>>num; } void game::result() { if … | |
Re: [QUOTE=GrimJack;705244]the armed forces are not trained in the concepts of law enforcement - this is not derogatory. The armed forces are trained to defend, attack, and contain; there is no real overlap nor should there be. If 2 police officers heard a bullet whiz by their heads, they would look … | |
Re: Code tags, formatting, and ask a specific question. Your question is way too vague and there's way too much code, even with formatting and tags, to go through without some guidance. [noparse] [code=cplusplus] // paste code here [/code] [/noparse] | |
Re: Not using code tags is a major problem. After a while, when one starts to add up the extra hours one spends making sense of unformatted code without code tags, it can get really irritating. Most people eventually won't even look at it if code tags aren't used. Anyway, just … | |
Re: [QUOTE=DeadJustice;705270]Alright that worked. Though there was one problem. An y with . . over it was put at the end. Could you explain that? EDIT: I also was wondering if I can merge all white space into one ' ' char as far as the vector is concerned.[/QUOTE] I don't … | |
Re: 1. ask the user for the master filename of all the truckers. 2. read that master filename into a string. 3. open the file with that master filename 4. set up a while loop 5. Read in a name from the master file 6. Get the filename associated with that … | |
Re: [QUOTE=blaze5488;704014]What is suppose to happen is that I am suppose to take a string like "Micheal Jordan" and reverse it and return it with a comma after the last name. like "Jordan, Micheal" but that is not what i am getting can you help please. I have also included the … | |
Re: [QUOTE=JustLearning;703825]First let me describe the program All it does is pull in some chars and stores them in a linked list of stacks. I have the code written to pull them in but when I need to print them I dont know how to go backwards without deleting the node. … | |
Re: [QUOTE=JackDurden;703855]Im just getting garbage in the output. It outputs the correct number of items but its not the right numbers. Im not sure why it is happening. The text file just has numbers like this: 12 34 56 34 67 23 64 23 [CODE]#include <iostream> #include <fstream> using namespace std; … | |
Re: [QUOTE=nizbit;702361]I know its a lot but I don't know really where to start troubleshooting it. The seg fault does not give me any info where the error is.[/QUOTE] Then you need to either use a debugger and put breakpoints in and see what lines are reached before the program seg … | |
Re: I haven't tried your code yet, but is there a reason why you are using a set rather than a regular boolean array? [quote] In my case though, i have to use a set to store my data. [/quote] Is this an assignment where the object is to demonstrate that … |
The End.