Forum: C++ 21 Days Ago |
| Replies: 8 Views: 194 If cin.ignore(); fails, then try clearing the input stream, before accepting input. This can be done with cin.clear();.
If all your inputs are failing, then maybe try the following:
1. Clear... |
Forum: C++ 21 Days Ago |
| Replies: 8 Views: 194 Try adding a cin.ignore(); statement before each of your inputs.
See this: http://www.cplusplus.com/reference/iostream/istream/ignore/
Incidentally, its better you don't use fflush(stdin);.... |
Forum: C++ 21 Days Ago |
| Replies: 4 Views: 248 You could try this:
FILE *in;
char line[1000];
char *token;
in = fopen(argv[1],"rt+");
if ( in == NULL) exit(1);
int i=0;
// Read the first line... move the file... |
Forum: C++ Sep 12th, 2009 |
| Replies: 4 Views: 268 I'm not sure whether this is what you are looking for, but try this:
infile.seekg(0, std::ios::end);
long fileEnd = infile.tellg();
long counter = 0;
while(counter != fileEnd) {
// do... |
Forum: C++ May 29th, 2009 |
| Replies: 8 Views: 318 Your output is expected, and here's the result (http://www93.wolframalpha.com/input/?i=sin(3.141592653589793)) of the same when I tried it on Wolfram's Online Math Engine.
Here... |
Forum: C++ May 28th, 2009 |
| Replies: 8 Views: 300 > What am I doing wrong???
A lot! .... but nothing that you can't learn from, with a little bit of effort... Your struct contains 2 functions, both of which can directly access the other struct... |
Forum: C++ May 28th, 2009 |
| Replies: 2 Views: 677 Wow! Good code :) beats mine by a mile... :) |
Forum: C++ May 27th, 2009 |
| Replies: 24 Views: 734 > where the city name next to weight is should be in alphabetical order.
What exactly do you mean by this statement? What "weight" are you referring to? And by "city name should be in alphabetical... |
Forum: C++ May 26th, 2009 |
| Replies: 3 Views: 1,241 So what do you suggest we do with it? We are not here to do your homework, just because you are too lazy to even attempt it. You have to show that you have at least made an effort to start your... |
Forum: Geeks' Lounge May 26th, 2009 |
| Replies: 44 Views: 3,084 > But I still fail to see how an electronic device can detect a ghost?? Especially since they are detached from their hard drives???
It puzzled me too, that's why I started this thread. I haven't... |
Forum: C++ May 25th, 2009 |
| Replies: 15 Views: 583 > cin >> can be used to enter a string (array of char) - it's perhaps the simplest input method to use.
Whoops! Sorry for the wrong info I provided! I guess I forgot about this fact because I've... |
Forum: C++ May 25th, 2009 |
| Replies: 15 Views: 583 > just a general function that has void infront of it rather than int.
Follow this example:
#include <iostream>
using namespace std;
void MyFunc(int num) |
Forum: C++ May 25th, 2009 |
| Replies: 2 Views: 677 My implementation of the strcmp and strncmp functions. I don't think that it is very efficient, but have managed to get both the functions' execution times to 0.01 s (At least, this is the value my... |
Forum: Geeks' Lounge May 25th, 2009 |
| Replies: 6 Views: 546 You just described my general view on politics/politicians :) |
Forum: Geeks' Lounge May 25th, 2009 |
| Replies: 29 Views: 1,726 Have a look at this: http://en.wikipedia.org/wiki/String_theory
If that theory (String Theory) can be proved, then the statement (made by the OP), cannot be proved wrong, at least from my... |
Forum: Geeks' Lounge May 25th, 2009 |
| Replies: 44 Views: 3,084 Nice link! So spirits, I take it, are harmless, even comforting entities to have around... I think I prefer being "haunted" by spirits rather than ghosts :) |
Forum: C++ May 25th, 2009 |
| Replies: 15 Views: 583 Much better (compared to the other revisions)! But you still haven't fixed //< MARKER (2) from my previous post! cin will not simply accept an array of characters. You have got to use the getline... |
Forum: C++ May 25th, 2009 |
| Replies: 2 Views: 187 This might be worth a shot: As you are going to only declare an object of the class GLCursor in your class FLGLWindow, and are not going to use its member functions directly (i.e, you are going to... |
Forum: C++ May 25th, 2009 |
| Replies: 13 Views: 534 Did you actually go through the links I gave, and the clue I provided in my previous posts? If so, did you not understand it? and no, your code still will read your file line-by-line.
> read from... |
Forum: Geeks' Lounge May 25th, 2009 |
| Replies: 44 Views: 3,084 > So as for ghost's- well maybe they are information without a hard drive! WOOOOOOOOOO! OOOoooooooo!:scared:
Oh My! I haven't laughed myself silly like I have just now in a long time :D ... Good... |
Forum: C++ May 25th, 2009 |
| Replies: 13 Views: 534 I have no idea where you are going to put this, so I don't know what it will accomplish. If it is inside your while-loop, then, no it will not help at all. Anyway, this approach undermines the... |
Forum: C++ May 25th, 2009 |
| Replies: 13 Views: 534 while (getline(iofile,line))
{
cout << line << endl;
}
Your code is on the right track. Check out the getline function's prototypes here: getline - C++ Reference... |
Forum: Geeks' Lounge May 25th, 2009 |
| Replies: 44 Views: 3,084 > if inanimate mass can evolve to a complex species like human being in few billions years
My view: Mass can never be inanimate, as atoms make up any mass, and atoms are certainly not inanimate... |
Forum: C++ May 25th, 2009 |
| Replies: 9 Views: 647 I tried the same code on the same IDE (same version as well), with the same compiler, running under Windows XP, and it executed perfectly. Check the integrity of your copy of GCC, and if it isn't,... |
Forum: C++ May 25th, 2009 |
| Replies: 4 Views: 195 See this post for more details: http://www.daniweb.com/forums/post875397.html#post875397 |
Forum: Geeks' Lounge May 25th, 2009 |
| Replies: 44 Views: 3,084 > (To jephthah): you can talk about your personal experiences and beliefs, but people who go around making declarative statements about the existence or non-existence of things that cant be... |
Forum: C++ May 24th, 2009 |
| Replies: 15 Views: 583 Firstly, I am not going to do the functions for you, but I'll show you where you are going wrong, and give you ideas on how to correct them. The following code is extracted from your program's case... |
Forum: C++ May 24th, 2009 |
| Replies: 4 Views: 927 Nice code! But maybe the function name pow should be changed, to avoid any ambiguity caused if anybody chooses to include <cmath> with that :) ... |
Forum: C++ May 24th, 2009 |
| Replies: 6 Views: 235 Here (http://www.dreamincode.net/forums/showtopic10157.htm) is a good tutorial on linked lists amongst other C++ data structures. Have a look at their implementation of a singly linked list, and try... |
Forum: C++ May 24th, 2009 |
| Replies: 9 Views: 301 > To the OP: You say that this function - cio_putstr() returns a void. If this is so, then just why is it in your for loop as a test expression? And could you explain what it - cio_putstr() - is... |
Forum: C++ May 23rd, 2009 |
| Replies: 7 Views: 327 > I have come as far as estimating fundamental matrices for the cameras.
You have mentioned in an earlier post that you know the camera's calibration. When you talk about a fundamental matrix... |
Forum: Geeks' Lounge May 23rd, 2009 |
| Replies: 44 Views: 3,084 Okay, I can't change the title of this post, and am truly sorry for the mis-post, but here is what I was writing before this happened:
The following discussion may give some (maybe most) people... |
Forum: Geeks' Lounge May 23rd, 2009 |
| Replies: 44 Views: 3,084 Oh no!... can this be deleted? I don't know what happened... I was typing in a new thread, and it got posted! I'm extremely sorry... |
Forum: C++ May 23rd, 2009 |
| Replies: 2 Views: 618 Please, refrain from hijacking threads. It would just confuse anyone having the same difficulty as the OP, and would make our jobs of attempting to answer to the original question difficult. If you... |
Forum: C++ May 23rd, 2009 |
| Replies: 4 Views: 320 What sort of idea do you have, right now, to do this? Post your idea first, and we can then correct that if its wrong... |
Forum: C++ May 22nd, 2009 |
| Replies: 12 Views: 906 Yeah, this is a good algorithm to use for the same... |
Forum: C++ May 22nd, 2009 |
| Replies: 7 Views: 327 An image has to be described on a 2D plane, so the z-coordinate does not come into play here. If you just want stills of your 3D simulation, maybe you should just try writing the pixel information of... |
Forum: C++ May 22nd, 2009 |
| Replies: 12 Views: 906 I hadn't realized that... thanks! :) ... But it does work as std::string in my IDE (Dev C++), and it (I mean, including <string.h>) does not produce any backward warnings at all... |
Forum: C++ May 22nd, 2009 |
| Replies: 12 Views: 906 Are you sure that this program compiles? You seem to have used string in your code, but you haven't included <string.h> at all...!
Apart from that, could you tell us what IDE/compiler you are... |
Forum: C++ May 22nd, 2009 |
| Replies: 3 Views: 693 |