- Strength to Increase Rep
- +8
- Strength to Decrease Rep
- -2
- Upvotes Received
- 17
- Posts with Upvotes
- 15
- Upvoting Members
- 12
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
| |
Re: Here's an idea: First check is your number teen, or not. If it is teen number (1 is first digit) then check second digit and write: [CODE=cplusplus] //just for example case 1: str = "Eleven"; break; case 2: str = "Twelve"; break; //... [/CODE] if it's not teen number, then … | |
Re: [QUOTE=themaestro;1353847]Thanks for the reply. The code above only writes "time exceeded" after the person has finished the quiz. Is it possible to prompt the command even if the user doesnt enter anything? Lets say he's only less than halfway through the quiz.[/QUOTE] It is possible, and it is called "threading". … | |
Re: Yes, you can, it is called recursion. Look it up on net | |
Re: And yet, scanf can be clever function: [CODE=c] #include <stdio.h> int main(){ char dump, string[40]; printf("Enter whole sentece (yeah, bring spaces too, I can handle it):\n"); scanf ("%[^\n]", string); scanf("%c", &dump); printf ("You entered: %s", string); return 0; } [/CODE] | |
Re: Unix has various flags. It doesn't have to do with makefiles. Try writing instead of _UNIX: _unix, unix, _UNIX_, UNIX... etc... The best thing is: see what compiler are you using, and then look at its documentation, because compilers are setting those flags, and different compilers name different names (for … | |
Re: 1. You are making memory leaks all over the place. When you operate with dynamic memory allocation you have the responsibility to free every part of memory that you don't use. 2. Instead of [ICODE]void main()[/ICODE] always write [ICODE]int main()[/ICODE] 3. myRemove() isn't working. Why are you creating a new … | |
Re: >I'm using Visual C++ and doesnt give me any compilation error it keeps giving me a run time error after i enter the 1st number i can't figure out whats wrong :S help?[/QUOTE] The only reason this code should give you error is if you input something else that float, … | |
Re: I guess you defined float stars[20][20]? You can't write stars[i] + stars[j], because you have to write two dimensions (two brackets): stars[i][j]... always. hth | |
Re: Never test end of file with .eof()!!! It's wrong. Instead, replace [ICODE]!indata.eof()[/ICODE] with [ICODE](indata>>info)[/ICODE] (and of course, remove same line after while) | |
Re: Line 8 of your code is: string constructor (string str, int number) Line 9 of your code is: string constructor (char* arr, int number) It's been awhile since I wrote in c++, but i think you can understand this. The point is that if you type "Initial", that's not object, … | |
Re: Have you called srand()? You need to seed the numbers first. You can look at this example: [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/rand/"]cpp useful webpage[/URL] EDIT: ok, I see srand now :D... Try to break your code a bit... segment by segment, to pinpoint exactly where it goes wrong... For example, try to print rand(), … | |
Hello. I've just started learning Python and I have a few questions. I'm using my program to communicate with some device through serial port using serial.py library. It's all going really fine. I've got a class device, and I'm using it to communicate with a device (logical ;) ). Q: … | |
Re: It should be like this (yeah, I like writing nonesence): [CODE=c] int i = 0; while ((string[i++] = getchar())!='\n'); string[i]='\0'; [/CODE] | |
Re: You could write your hex-to-deci function, and then you can simply write [ICODE]char a = hex-to-deci-function(hex_num)[/ICODE] | |
Re: [QUOTE=sambafriends;727086]thanx for replay can u explain briefly I used void so, there is no need to return any value[/QUOTE] You can drive your car without fastening seat belt, or walk through minefield :) But it's risky! So always use [ICODE]int main()[/ICODE] and return zero if succesful (in which case you … | |
Re: If you are running it under Windows XP CMD than it will only affect that window, because XP just simulates command prompt, doesn't load real one. So, answer to your question, if you are running XP, is NO | |
Re: Please post at least head of your header file... Until then, this: [URL="http://msdn.microsoft.com/en-us/library/f6xx1b1z(VS.71).aspx"]googleing![/URL] says this: [QUOTE]Linker Tools Error LNK2001 unresolved external symbol "symbol" Code references something (such as a function, variable, or label) that the linker can't find in the libraries and object files. Possible causes * What the code … | |
Re: What have you done so far? We don't solve homeworks | |
Re: Problem is you are going both ways! You are incrementing i iterator and at same time decrementing ptr_size2. Write something like: [CODE=C] ptr_size2 = ptr_size; temp = ptr; while (ptr_size2>=0) { temp[ptr_size-ptr_size2]=ptr[ptr_size2--]; }[/CODE] | |
Re: AFAIK brackets can be used without any function or if statement, simply as code-block. They just come in handy for functions, classes, etc. | |
Re: why do you need kbhit? kbhit works more like a detector if key is pressed, it doesn't wait for keypress. Simply use getch? | |
Re: What do you really want? How to create Clist? or? | |
Re: What does Earray point to? You've made it to null pointer: [ICODE]Earray[i] = 0 //like NULL[/ICODE] And your EmpPointer is unused... Seems like to me you're trying to allocate 2D array of some sort, but doing it wrong | |
Re: hmm... write your own mul using logical operators and and or? I'm a beginner too, so don't really know how, but I'd try something with that Although it's not elegant solution | |
Re: It works on my Dev-cpp (mingw, gcc) compiler, and I can't see any problem with code, so it's probably something about your compiler. | |
Re: Well, you obvioulsy need to increment counter each time you add a node, and decrement it each time you remove a node. It's really not hard, just put it in insert, delete, and create list. For checking if list is empty... simply check if first==NULL. But don't you need some … | |
Hi! I have the following code: [CODE=asm] mov al, 5d neg al[/CODE] When it executes, CF = SF = AF = 1 Ok, I think I understand why AF (number is bigger than 00001111b ?), SF (most significant bit is now 1 not 0) But what I don't understand is … | |
Re: Make pointer to pointer [ICODE]**ptr[/ICODE], and allocate n pointers to it. Then to each of that n pointers [ICODE]*ptr[i][/ICODE] allocate n int's (or whatever). After that you can use it as regular 2D array: [ICODE]ptr[i][j][/ICODE] | |
Hello to all of you! I would really appreciate somebody telling me complete step by step tutorial how to work with MASM (or TASM, but I haven't noticed it's free to download) I've tried myself MASM and TASM (some Telemark assembly, not Borland), but for some reason it won't work, … |