481 Posted Topics
Re: [code=cplusplus]if (argc=='0'){[/code] Do you realise what you are doing here? argc is a number representing the number of command line arguments passed to your program. '0' is equivelant to 48, so you say if 48 command line arguments are passed then do X. I expect that is now what you … | |
Re: [CODE=cplusplus]for(counternumbers = 1; counternumbers <= 19; counternumbers++){ cout << digit[counternumbers] << ", "; } cout << digit[counternumbers];[/CODE] First things first, Arrays are 0 index'ed. This means the first element within the array is 0 not 1. That is your first mistake. Number 2, you have an array of size 19 … | |
Re: Note there is also no such thing as this #include<stdio> it should be csdtio.... but you can ditch that if you change getch() to cin.get() Please don't blame a compiler/IDE for your mistakes. By the way Dev-Cpp is dead IDE. It's advised you swap to Visual C++ (express 2008 its … | |
Re: [QUOTE=Narue;757877]That's nice. Have fun.[/QUOTE] That's the no-shit way of saying, read the posting rules before you make a post. Also it helps to ask a question and present us with some problematic code or logical issue. I'm sure you can find the posting guidlines thread. Also learn to use code … | |
Re: If you want us to comment on your sort code, simple past the sort code and thats it. this is the pseudocode for a bubble sort [code]procedure bubbleSort( A : list of sortable items ) defined as: do swapped := false for each i in 0 to length(A) - 2 … | |
Re: There are MANY problems with you code i'm just gonna post a few to get you started with something to sort out. My first comment is that you should be using [iCODE]#include <ctime>[/iCODE] rather than time.h number 2:[code=cplusplus]char* getMessage(const int messageId) { return messages[messageId].c_str(); }[/code] You have not defined messages...i … | |
Re: Then you would of tried and then realized it wasn't possible or failed trying and asked for help and someone would of helped you out. Either way it would of been a learning experience even if it wasn't possible. Chris | |
Re: [url]http://tinyurl.com/6bdfm[/url] [url]http://tinyurl.com/5r37hk[/url] and my favorite by far [url]http://tinyurl.com/5l7ufy[/url] Chris | |
Re: [URL="http://www.cplusplus.com/reference/clibrary/cctype/isalpha.html"]isalpha()[/URL] Loop throught the input string, copy any alpha characters across to a new string, just ignore others Chris | |
Re: [QUOTE=ademsaykin;757130]Dear Ninwa Thanks for your reply but still I can not write the whole coding structure which I needed.It doesn't make any sense to me. I shoud be able to compile and run it in order to see how it works. I would be very happy if you could write … | |
Re: Then it should be [code=cplusplus]ifstream myFile("rawDictionary2");[/code] So it is actually a file object rather than a string object! Chris | |
Re: [noparse][code=cplusplus]//your code here[/code][/noparse] Chris | |
Re: This is not a C++ programming question. It's an ontroduction...Try posting in the correct lobby next time. In this case that would of been the [URL="http://www.daniweb.com/forums/forum165.html"]community introductions[/URL] Chris | |
Re: [url]http://www.cplusplus.com/reference/clibrary/cctype/tolower.html[/url] Chris | |
Re: Thats because total is never initialized to 0. So you start with a random number from somewhere in the CPU's memory then start incrementing it by 1. This is bad! very bad! Chris | |
Re: please use code tags, and avoid red text many people will be repelled by it! [CODE]define IS_STRING 1 define IS_CHARACTER 2 define IS_INTEGER 3 define IS_FLOAT 4 [/CODE] This is to make a it easy for you to understand, basically writing IS_STRING is exactly the same as writing 1. [CODE]bool … | |
Re: Please use code tags, [noparse][code=cplusplus][/code][/noparse] also please try to post a specific question. We will not just do the rest of your project for you. You need to actually hve a problem before we can answer it. Chris | |
Re: A homepage for a website? If so you should look into HTML/XHTML aswell as things like PHP Javascript...You may find this site helpful [url]http://www.w3schools.com/[/url] p.s if this guess was right your in the wrong forum :D If not a website i'm confused by your question. Chris | |
Re: Indeed, the more time you put into writing your question. Making it clear and clean. The better laid out and grammatically correct, the faster and more accurate your reply will be. Just remember that, the more time you put in the more of others time you get back. It's simple … | |
Re: Rather than me explaining it, i'll give you something to look at and think about. try adding the following line into your code, just inside the second foor loop [code=cplusplus]cout << "D: " << d << " B: " << b << " (" << d+b << ")" << endl;[/code] … | |
Re: You have some very confusing idea's here. Some of which are potentially dangerous. [code=cplusplus]for (int q=1; q > argc; q++){ a.open(argv[q]); }[/code] What do you hope to achieve with this? Firstly if q ever was greater than argc then you would be stuck in an infinate loop, trying to open … | |
Re: [QUOTE=jbennet;754518]MS Visual C++ Express 2008 Dev C++[/QUOTE] VC++ is a good idea, Dev-Cpp is a dead project don't bother. Instead you could try codeblocks Chris | |
Re: There are alot of people that ask about card games and black jack on these forums. Why don't you search the forum and have a look over other threads solving common problems...also you can look at some example code to help you. Chris | |
Re: You should double backslash \\ Chris | |
Re: I strongly adivse you use code tags [noparse][code=c][/code][/noparse] Also this looks like C code to me... So perhaps you should post in the C forum. Chris | |
Re: Welcome to DaniWeb StainlessSteelR? Or are you just taking the code he happened to past and chaning it and still not reading the thread.... I'm not too sure. Anyways I think you will find this most interesting. It solves your problem multiple times. [url]http://www.daniweb.com/forums/thread161095.html[/url] For almost identical code! Chris | |
Re: There's a stray bracket in your while loop, also i think you should be using doubles not ints... Chris | |
Re: [URL="http://www.letmegooglethatforyou.com/?q=Bottom-Up+Merge+Sort"]I'm not too sure[/URL] Chris | |
Re: Use a couple of substrings to get the IP address since you know its always going to say, Current IP Address: you can use find to find that string, it will return the position in the string of the first character, you can then add 20 to that to give … | |
Re: What he is saying is you cannot create an array of size N like that. Arrays are constant and cannot. he suggested the use of vectors, which can be any size and you dynamically add to them! The other option would be a dynamically assigned array... an example of what … | |
Re: [CODE]int myArray[10]; myArray[[COLOR="Green"]0[/COLOR]]= 1;[/CODE] That is the array index, note arrays are 0 index'ed meaning the first entry is always at 0 never 1 Chris | |
Re: OK, here is my sugestion...please bare in mind i know nothing about Python GUI and event handling so i cannot really provide any sort of code examples. You need to ensure that the media has loaded correctly before you can play it. So the best way to doing this is … | |
Re: There shouldn't be a problem here... i just created a simple program to open a file that contains some text in exactly the same mode as you, and called seekg(0, ios::beg) without a problem... you could always try calling f.clear() before hand... Chris | |
Re: You have to do some manual searching and it is operating system specific. For windows you might wanted to take a look on msdn. You should find these links helpful. [url]http://msdn.microsoft.com/en-us/library/aa364418(VS.85).aspx[/url] [url]http://msdn.microsoft.com/en-us/library/aa365527(VS.85).aspx[/url] [url]http://msdn.microsoft.com/en-us/library/aa364232(VS.85).aspx[/url] Chris | |
Re: You need to learn to debug yourself. use print statements so you can just exactly when it crashed. Use a debugger :shock: step through it line by line until it crashes. Also is the C++ or C? and from now on NEVER user void main() always use int main() and … | |
Re: Indeed, I happen to know of a rather popular Open hacking forum...i use it from time to time for some more obscure code snippets to learn from, normally things that involving working with OS dependant calls. I don't understand why you would want to write a virus when you could … | |
Re: You need to look into operators, You may find this useful [url]http://www.cs.caltech.edu/courses/cs11/material/cpp/donnie/cpp-ops.html[/url] Chris | |
Re: [QUOTE=Shinedevil;751660]Well generally, you will always have the ability of a loss. Even the computer defined AI will screw up alot of times. To make it so that it will always win or always draw are almost impossible. There will always be a chance that the Human Opponent will win, wether … | |
Re: Either way you are going to have to make sure you clean up all memory assignments. The bonus of new/delete over malloc/calloc/realloc/free is the fact that new and delete call constructors and destructors of classes (potentially allowing you to clean more memory up easier. This was also the reason for … | |
Re: The two previous posters are correct, just a note although the logic behind it is not too hard, i would suggested you go over the manual method on paper so you know for sure what you are doing before you start writting some code. Otherwise you may get even more … | |
Re: Indeed, this statement is like a an if statment its equivelent would look something like this. [code=cplusplus]string myIF(int a){ if(a > 0){ return ", "; }else{ return " "; } }[/code] Hope that makes sense Chris | |
Re: The reason that doesn't work is because it's an incorrect method of reading what is at point i in the vector. You should be using his method PtrMyVector->at(i); Also i wanna make this comment: do NOT use void main()!!!! use int main() and make sure you return and interger! (return … | |
Re: You can still use the windows API in your console application. There is no standard sockets implementation. So you need to use API calls, be it Win32 or POSIX. Chris | |
Re: [QUOTE=ohlaph;751207]our instructor wants us to use the !variable.eof() so how would I use it without messing things up? Also, I tried the .good(), and it just ran through the file once, didn't actually loop. Second, I used a debugger, it came back with no errors. Which is why I came … | |
Re: This is a common problem, it seems you have to manually include the mail module, this link maybe of help to you [url]http://stackoverflow.com/questions/169897/how-to-package-twisted-program-with-py2exe[/url] Also another suggestion rather than py2exe use bbfreeze [url]http://pypi.python.org/pypi/bbfreeze/0.95.4[/url] Chris | |
Re: guesssheet[y] = s in your if statement it should be == You are trying to set it equal to rather than comparing Chris | |
Re: Firstly, please don't hijack others threads...start your own in future. Your syntax error is the fact that you have a do..while loop definded as follows [code]do{ //somecode }[/code] with no while statement [code]do{ //somecode }[COLOR="Red"]while(somecondition);[/COLOR][/code] Chris | |
Re: Here this link might help you out if you already know C++ and your just a bit rusty [url]http://www.cppreference.com/wiki/[/url] Brilliant refrence also [url]http://www.cplusplus.com/reference/[/url] has some nice stuff on it Chris | |
Re: [code=cplusplus]#include <string> ... string myArray[] = {"Cat", "Dog", "House"};[/code] Hope that helps, Chris | |
Re: Either way very very old thread, don't drag anymore up SRaj Chris |
The End.