2,827 Posted Topics
Re: Your recent threads all have the same underlying problem. You need more than 64 bits of precision and you are only using a data type that can store 64 bits. You either need a data type that holds more or you need to convert the problem somehow so that you … | |
Re: We had MAME installed on our X-Box at home as well as on the computers (they played better on X-Box), and a friend built a really great MAME cabinet. The early 80's produced some great games. Friends would bring over recent X-Box games and I'd ignore them and go straight … | |
Re: It's hard to give much of a hint since we don't know what your expertise level is. We don't know if you know how to use classes. If so, you could set up classes like [ICODE]Seat[/ICODE], [ICODE]Row[/ICODE], [ICODE]Airplane[/ICODE]. If not, the issue is moot. Regardless, split the assignment up into … | |
Re: On line 58, you read in a character from the user and store it in a char variable called [ICODE]question[/ICODE]? Is that correct? I don't see you use this [ICODE]question[/ICODE] variable anywhere, so what are you supposed to do with it and what does the user enter when prompted? So … | |
Re: [code=cplusplus] int char2int(char c) { switch(c) { case '0': { return 0; } case '1': { return 1; } case '2': { return 2; } case '3': { return 3; } case '4': { return 4; } case '5': { return 5; } case '6': { return 6; } case … | |
Re: [QUOTE=berting;764667]i need to write a program which inputs an integer value, checks that it is possitive, and outputs its factorial,using formulas factorial(0)=1 factorial(n)=n*factorial(n-1) sample output: input possitive number: 6 factoral of 6is: 720[/QUOTE] What's the question? | |
Re: [QUOTE=confusedGirl;764006]Hi all I have a [COLOR="Red"]miniproject [/COLOR]I need to submit tomorrow ,but I didn't finish it.. Please if any member have a time to check it for me,,tell me so I can send my whole work... I really will appreciate your help Please help me ....Iam so sad its 50% … | |
Re: [QUOTE=NewtoC++;764192]Sorry its not solved. This still doesnt solve my problem. I think I phrased my question incorrectly. How do I give a user the ability to name the objects that I create? For example if they enter "Bob" I want to create an object with "Bob: class example{ }; example … | |
Re: There is no "right" and "wrong" in these types of designs, but rather "pros" and "cons". You are trying to write some generic classes so that you don't have to rewrite everything for each different game, which is good. At some point, the games get so dissimilar that it's no … | |
Re: Type in "power series C++" into Daniweb's search box and some related threads will come up. Also, please use code tags. [noparse] [code] // paste code here [/code] [/noparse] Also, never, ever use [ICODE]void main ()[/ICODE]. [url]http://www.daniweb.com/forums/thread78955.html[/url] [url]http://www.daniweb.com/forums/post50869.html[/url] [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044841143&id=1043284376[/url] [url]http://www.gidnetwork.com/b-66.html[/url] | |
I have a problem that I have "solved" in that it now does what I want, but I'd like to know why it works. I have a JFrame. Within that JFrame I have three JPanels, which I'd like the user to be able to adjust. I would like to be … | |
Re: enum would work or you can use the / and % operators to get the value and suit. 22 is a bad choice for 2 of clubs in my view. 2 of clubs should be 1, 14, 27, or 40 depending on whether clubs has a value of 0, 1, … | |
Re: [QUOTE=babi;758132]I need to use an array of chars to input chars from the console but I don't know how many chars will be actually inputed. How can I have an array of chars whithout knowing its size in advance? I could put the array with a very high size but … | |
Re: [QUOTE=Dannielf;758966]I'm doing a program that shows which tickets have been sold for an auditorium. I am a beginner to c++ so I am not sure how I can do the following: a) Allocate an input with a character (e.g. when I enter 'A10' .. how do I allocate 'A' to … | |
Re: Here's chapter 2. [url]http://linuxlock.blogspot.com/2008/12/character-assasinations-aint-us.html[/url] | |
Re: [QUOTE=clb8372;758924][code] I understand that my instructors feed back is straight forward, but I am new to creating pseudo codes and I am just not sure how the corrections are suppose to look, for example "Why do you have a variable named ItemName? Variable names should be descriptive of what they … | |
Re: I get a compile error on line 39: [code] if (list <= list[mid]) [/code] [quote] ISO C++ forbids comparison between pointer and integer [/quote] | |
Re: [QUOTE=ninja_gs;758717]can any one provide me a sample code for it ........????? plz[/QUOTE] Sample code for what? A sorting algorithm? Sorting characters as opposed to integers (as Mosaic mentions, characters are treated as integers, only they don't have as big of a range). Lots of sample code out there. Check the … | |
Re: [QUOTE=Se7Olutionyg;758267][CODE]#include <iostream> #include <cmath> using namespace std; float scale (float,int) ; int main() { float num1; int num2 ; cout << "Enter a real number : " ; cin >> num1; cout << " Enter an integer: " ; cin >> num2; cout << " Result of call to function … | |
Re: [QUOTE=NinjaLink;757557]I just want to know what I need to change in my code to make insertBack into insertFront and deleteFront to deleteBack. Do you know what I need to change to make this happen?[/QUOTE] [QUOTE=NinjaLink;757557] For Linked Lists, I know the code for insertBack and deleteFront.... [/quote] No, you DON'T … | |
Re: You should probably have your [ICODE]printTime ()[/ICODE] function call the [ICODE]toString ()[/ICODE] function. It's the same code. No sense writing it twice. Regarding going from 0 to 59 and 0 to 23 and not beyond, in your increment functions, use the / and % operators. Add the new amount to … | |
Re: [QUOTE=gunsmith2112;757116]I have changed the <time.h> to <ctime> but since my program is small and that it does not judge a score or take in a lot of numbers into the program since it is rand generated i have found it very hard to incoorperate an Array into my simple game. … | |
Re: [QUOTE=anbuninja;757148]Hey Im having my final this week and its going to be on loops. Anyone got any good website on loops?[/QUOTE] Google is your friend. [url]http://www.cprogramming.com/tutorial/lesson3.html[/url] | |
Re: Another homework dump, a verbatim copy and paste straight from the assignment sheet, with nothing to suggest the OP has put any thought at all into it. If you are a first year C++ student, your tutor is high. Ignore the 25 minute estimate completely. It'll take you that long … | |
Re: [QUOTE=ai0372;753929]1. Cause if i don't extend it.. i have errors in my ATM class. 2. How do i store the pin number and account number? in arrays? i can't get it.. the program should start by initializing and declaring a single atm object which in turn initializes it's account objects.. … | |
Re: A firebomb is a lethal weapon and therefore lethal force is justified by police to prevent it from being thrown, in my view. When a minor is threatening you with a lethal weapon, you no longer have to treat him with the restraint you might normally treat a minor and … | |
Re: A big problem is the drivers. I bought a laptop with Vista installed on it a year an a half ago. It came with a disk with drivers on it, but they were all Vista drivers. I checked the manufacturer's website for other drivers and all there were were Vista … | |
Re: [QUOTE=clueless101;755389][code] public static int[] guess = {5,9,0}; [/code] with: [code] int[] guess = new int[10]; for (int i = 0; i < 10; i++) guess = i; [/code][/QUOTE] There's nothing random about this. Three questions you need to decide. One, how many elements should be in the array? Two, what … | |
Re: [QUOTE=cerb63;738218]I tried that and ended up with a compiler error and I still don't know what I did wrong[/QUOTE] We don't either until you show what you tried. Lerner is correct. You need the arrow operator, not the dot operator. Currently you have the dot operator. Use code tags: [noparse] … | |
Re: [QUOTE=firstPerson;753251]All this expert and no answer?[/quote] There's no reason to say stuff like this. It just antagonizes people. [QUOTE=firstPerson;753251] how about this can i somehow define a literal string with A,J,Q,K,J? then pick it out of that or something?[/QUOTE] Create a character array: [code] char cards[] ={'J', 'Q', 'K', 'A'}; … | |
Re: [QUOTE=musham;753764]i want the code in JAVA for the program [COLOR="Red"]"To find the shortest path using the fuzzy logic"[/COLOR][/QUOTE] I want a new car. With any luck, Santa Claus will help us both out. If you want help BEFORE Christmas, though, you are going to have to be more specific and … | |
Re: [QUOTE=capricornia;753928]well excuse me, but i'm kinda new to this and haven't mastered the terminologies just yet. in any case, i use 'Dev-C++' and DOS.. and what i mean by it doesn't work is the DOS window closes before i see the output.[/QUOTE] This program doesn't compile. There will be no … | |
OK, I've been reading a lot online and I think I can't do this, but I'm really hoping someone has a clever workaround. What I have is a bunch of classes with Color attributes. I'm also storing the red, green, blue, alpha values as integer attributes in those classes because … | |
Re: [QUOTE=mahlerfive;753317]And your question is?[/QUOTE] [QUOTE=star100;753776]how can i code for student data base using this information? [/QUOTE] I don't think that's what mahlerfive meant when he asked what your question was. You simply reposted the assignment, then asked how to code it. You need to make an attempt and then ask … | |
Re: You are using some nonstandard #include files and you have both stdlib.h and cstdlib: [code] #include <iostream> #include <cstdlib> #include <time.h> #include <string.h> #include <fstream> [COLOR="Red"]#include <windows.h>[/COLOR] [COLOR="Green"]#include <STDLIB.H>[/COLOR] [COLOR="Red"]#include <conio.h> #include "pause.h" #include "clrscr.h"[/COLOR][/code] I had to take all of the cls commands out because my compiler doesn't have … | |
Re: You need to either put [ICODE]using namespace std;[/ICODE] at the top or use [ICODE]std::cout [/ICODE]and[ICODE] std::cin[/ICODE] | |
Re: [QUOTE=StainlessSteelR;752500]The professor has not taught us "class Card"; so I'm not really sure what you're talking about,[/QUOTE] I like ArkM's solution! I'm going to +rep that one too! As to the many threads dealing with Card Shuffling, I recently added my own snippet. [url]http://www.daniweb.com/code/snippet1019.html[/url] Of the two methods in it, … | |
Re: [QUOTE=afg_91320;719402]^^um...that didnt help. sorry. can someone help by [I]showing [/I] how the code should be (or an example?) i know that arrays are like pointers but how does it apply to the particular code i am trying to work on [I]right now?[/I][/QUOTE] Well, it should have helped at least a … | |
Re: [QUOTE=michael1201;647656]The rules of Sudoku state that a Sudoku puzzle is solved when the 9x9 game board contains the numbers 1 through 9 exactly once in each row, column, and 3x3 box The numbers can appear in any order and diagonals are not considered.[/QUOTE] I'd have some boolean functions to check … | |
Re: [code] srand((P1Cards[i])time(0)); [/code] What are you trying to do here? Either seed the RNG with time (0) or with P1Cards[i], but not both. | |
Re: [QUOTE=FrancisC07;750713]i need a help on how to add the value of an array to another value of an array?[/QUOTE] Value of an array? I don't know what that means. You are going to have to elaborate, I think. | |
Re: [QUOTE=spi02;749857]I have since realized that 10^23 is not possible given that the record is 10^12 flops.... I now want to try all permutations with 15 items chosen or less... so it'd be 71C15+71C14+71C13+71C12... scenarios Does anyone know how I can implement this?[/QUOTE] I don't know what calculations you are thinking … | |
Re: [QUOTE=cherryteresa;750289]You're right, I was thinking about how all this math ties together. It's crazy to think about sometimes! Okay, so thank you for pointing out the power thing. I think this is where I got stuck before. I'm trying to figure out how to raise something to the power. We … | |
Re: This is actually harder because the maze itself has a lot of extra white space so there is not a unique solution. It will be easier in some ways to program for a maze where all the paths are only one character wide. Best foolproof algorithm is to always keep … | |
Re: [QUOTE=cinderla;749595]ya i need help just want to read a file by using file functions. by reading a file all the datas will be in a buffer know. in the buffer i want to rretrieve 8 bytes , how to do this ?[/QUOTE] If you are reading files and using buffers … | |
Re: [QUOTE=JackDurden;748953]How would I delete one char from a string? [CODE]string aWord = "question?"; while(aWord[i]) { if(isalpha(aWord[i]))printf ("character %c is alphabetic\n",aWord[i]); else delete[i]aWord; i++; }[/CODE][/QUOTE] Use the replace function from string: [url]http://www.cplusplus.com/reference/string/string/replace.html[/url] [code] string aWord = "abcdef"; aWord.replace (3, 1, ""); [/code] [ICODE]aWord[/ICODE] now contains "abcef"; Edit: Or just use erase: … | |
Re: [QUOTE=svetlana6167;747168]1. printf("%d", 10*5/10); what is this result? 2. printf("%d", 10+5-5); what is this result? 3. a=d++ +(b=a); a=4,b=4,d=4 a=? 4. c=a+ a++ - b--; a=4,b=4 c=? 5. c=a+ ++a - b--; a=4,b=5 c=? 6. if(a==0 && b==0) printf("1); else if(a==0 && b==0) printf("2"); else printf("3"); (if a=1 and b=0) what … | |
Re: [code=cplusplus] for(int i = 0; i < 1000; i++) { msg[i].convertToString(messageID); getline(inFile,data); msg[i].setDate(data); getline(inFile,data); msg[i].setSender(data); getline(inFile,data); msg[i].setRecipient(data); getline(inFile,data); msg[i].setBody(data); } [/code] Line 3. There is nothing to convert, since you've never actually read [ICODE]messageID [/ICODE]in from the file, have you? What conversion is required, by the way? You store messageID … | |
Re: [QUOTE=Sereal_Killer;747407]hmmm . ok ill keep looking i gues . its just that the teacher kinda threw this at us lol and suposed to be done by monday . but thanks ill just keep looking at tutorials online to see if i can find the answer .[/QUOTE] Here are the documentation … | |
Re: This thread is over three years old. [ICODE]conio.h[/ICODE] is non-standard. [ICODE]cin.get () [/ICODE]is standard. See this thread for how to keep the command window open. [url]http://www.dreamincode.net/forums/showtopic30581.htm[/url] |
The End.