Forum: C++ 1 Day Ago |
| Replies: 4 Views: 118 I'd guess that what's holding up the program is printing to the console output, which is a slow process. Try writing to a file instead and it'll probably help with speed. Then see if you need to... |
Forum: JavaScript / DHTML / AJAX 8 Days Ago |
| Replies: 3 Views: 339 I'd say the easiest way to do it would be to do something like<form method="post" enctype="multipart/form data" action="submit.php">
<select name="one" onChange="submit('one')">
<option... |
Forum: C++ 8 Days Ago |
| Replies: 9 Views: 307 You really should comment your code.
And on a side note check out cin.ignore(); after cin>>'ing. |
Forum: C++ 10 Days Ago |
| Replies: 9 Views: 319 |
Forum: C 11 Days Ago |
| Replies: 14 Views: 625 This thread is stupid.
ahamed101 -- save the data in files and fopen them according to the input parameters of the program.
OR do what you were doing with the #include and just live with code... |
Forum: C++ 11 Days Ago |
| Replies: 6 Views: 259 |
Forum: C 11 Days Ago |
| Replies: 14 Views: 625 Actually.
The #include thing only works on compile time. Not run time. So you can't strcat the value of the #include.
Also, your first example mightn't work the way you think. |
Forum: C++ 14 Days Ago |
| Replies: 11 Views: 431 >> sizeof( any pointer ) is always the same
>> That happens to be true for the garden variety PC of today, but it is not true as a generic statement.
Also, on the same system fat pointers are... |
Forum: C 30 Days Ago |
| Replies: 3 Views: 313 Does the second program have to do the same thing as the first but must be written differently?
You could always do a switch on readValue instead of the if tree. |
Forum: C 32 Days Ago |
| Replies: 6 Views: 324 I'm no assembly guru, but you might be able to find something were you to decompile it. |
Forum: C++ Oct 16th, 2009 |
| Replies: 3 Views: 472 All that changes with iterators that aren't 'int's is the template argument. http://www.cplusplus.com/reference/stl/vector/erase/
std::vector<randomType> myVec;
// Fill the vector with something... |
Forum: C Oct 14th, 2009 |
| Replies: 4 Views: 350 That's curious.
Try doing \r\n instead. Not sure if that'll help, to be honest, but worth a try.
Can you get a hex editor and look at the hex of the file and see if the \n character is there? It... |
Forum: C++ Aug 12th, 2009 |
| Replies: 3 Views: 326 Someone asked something similar before in another forum (http://cboard.cprogramming.com/cplusplus-programming/107469-custom-loose-coupling-string.html) and you could do something like this.class... |
Forum: C++ Aug 10th, 2009 |
| Replies: 2 Views: 441 You could have it so the constructor requires a flag to ID the allocated item... so something like...class base {
public:
enum derrivableIDs {
idBase,
idOne,
idTwo
};
... |
Forum: C++ Aug 8th, 2009 |
| Replies: 6 Views: 339 Curious. You should use std::strings really...std::string strItoA(int number) {
std::ostringstream sin;
sin << number;
return sin.str();
}Though Narue may tell you to generalise... |
Forum: C Aug 2nd, 2009 |
| Replies: 5 Views: 374 I was thinking that too, but figured he wanted to ... transpose it for his own reasons. |
Forum: C Aug 2nd, 2009 |
| Replies: 5 Views: 374 First consider not globalising all the variables and consider passing them by pointer or something from main().
Second, the line should be stringarray[j][0] = string[j]; That should be it,... |
Forum: C++ Jul 19th, 2009 |
| Replies: 5 Views: 374 http://www.codeguru.com/forum/showthread.php?t=302806
First hit on google.
Basically, it extracts segments from a varaible, i.e. the higher or lower 16 bits. |
Forum: C++ Jul 19th, 2009 |
| Replies: 14 Views: 564 You should read about getline here, http://www.cplusplus.com/reference/iostream/istream/getline/
Personally, I'd use std::string-s and getline... #include <string>
#include <fstream>
#include... |
Forum: C May 14th, 2009 |
| Replies: 11 Views: 1,275 Read here http://www.adrianxw.dk/SoftwareSite/FindFirstFile/FindFirstFile1.html (and part 2 and 3), and in the retrieving loop you could simply have a counter that's returned by the function. |
Forum: C++ May 3rd, 2009 |
| Replies: 5 Views: 324 Nah. You'll probably have to specialise the template, I'd say. Or overload a > operator, if you feel like it. |
Forum: C++ May 2nd, 2009 |
| Replies: 2 Views: 836 You can do what's called 'template specialisation' which will implement certain functions for a specific type, basically.
template<typename ty>
class myClass {
private:
ty var;
public:
... |
Forum: C++ May 2nd, 2009 |
| Replies: 4 Views: 461 Nope.
class thing {
private:
std::string str;
public:
thing(std::string _str)
: str(_str) {
}
std::string &getAttribute() { |
Forum: C++ May 2nd, 2009 |
| Replies: 4 Views: 461 aa is a pointer so you have to either dynamically allocate an instance of a, or set it to the address of an already instantiated instance, and call aa->getAttribute();. Alternatively doaa a;... |
Forum: C++ Nov 22nd, 2008 |
| Replies: 12 Views: 1,321 Well, there are two common ways you can represent complex numbers. One is a+ib where i is the root of -1, which is NOT -1. This is called the Cartesian (or rectangular) coordinate system. The second... |
Forum: C++ Oct 15th, 2008 |
| Replies: 3 Views: 889 goto (http://xkcd.com/292/) |
Forum: C++ Oct 11th, 2008 |
| Replies: 11 Views: 1,460 I think you might have to return a reference/pointer to the stream. Though if it's a local variable you might have to return a dynamically allocated stream. |
Forum: C++ Oct 1st, 2008 |
| Replies: 7 Views: 1,553 >> Gee, what more do you want?
A clickable link would be nice. I don't want to have to copy and paste again, Salem! |
Forum: C++ Sep 29th, 2008 |
| Replies: 5 Views: 438 Because they do input or output. One could say the same about your FileHandler class. Meh. If you're only gonna be reading use ifstream, only writing use ofstream, if you're gonna be doing both use... |
Forum: C++ Sep 29th, 2008 |
| Replies: 5 Views: 438 If you use fstream you can both read and write to the strem. http://www.cplusplus.com/reference/iostream/fstream/ To be honest, I don't see the point in reinventing the wheel, but what the hey. Why... |
Forum: C++ Sep 28th, 2008 |
| Replies: 13 Views: 1,052 I made one list (mylist *l) and added an element to it (l->next = new mylist;), then compared items in the same list (iter->num > iter->next->num). iter is simply a pointer which points to the... |
Forum: C++ Sep 28th, 2008 |
| Replies: 13 Views: 1,052 Here's a very crude example which I haven't tested, but even if it doesn't work it'll show you how to go about the problem...struct mylist {
int num;
mylist *next;
};
int main( void ) {
... |
Forum: C++ Sep 28th, 2008 |
| Replies: 13 Views: 1,052 Maybe something like:nodo *p1, *p2;
p1 = List;
p2 = List->next;
if ( p1->key == p2->key ) // or p1->key == p1->next->key
// do this...Your problem is that you don't have a random access... |
Forum: C++ Sep 25th, 2008 |
| Replies: 4 Views: 600 In my opinion without some careful management it's asking for trouble. Why do you have to open it? Couldn't you do something like...std::[i/o]fstream fstr;
// ...
fstr.open( "file_name" );... |
Forum: C++ Sep 22nd, 2008 |
| Replies: 10 Views: 915 To understand the reasoning of this execute the following:int main() {
std::cout<< sizeof( unsigned long) << ", " << sizeof( unsigned short ) ;
return 0;
}Basically short*short = short, but... |
Forum: C++ Sep 14th, 2008 |
| Replies: 6 Views: 1,454 #include <iostream>
#include <vector>
int main( void ) {
// 4x5 (4 in x, 5 in y) array, containing -1
std::vector< std::vector<int> > vvint( 5, std::vector<int>( 4, -1 ) );
for( int... |
Forum: C Sep 14th, 2008 |
| Replies: 5 Views: 534 I think you have all your numbers mixed up... you're scanning d, a is used as the while loop control, c has 2 being subtracted from it, and then you're printing a. You only need one variable. So... |
Forum: C Sep 13th, 2008 |
| Replies: 5 Views: 534 So a number is taken from a user, and 2 is subtracted from it until it's 0? Why do you have an array or a[100]? Do you need to save each number? Just try to think about it.
Problem:
You're... |
Forum: Geeks' Lounge Jun 20th, 2008 |
| Replies: 14 Views: 1,766 I dunno... babies sleep for like 12 hours a day. My nephew's like 1 sleeps from 8PM to 7AM with a nap for an hour or so. |
Forum: C++ May 29th, 2008 |
| Replies: 6 Views: 938 So it'll say like 13 and you want to grab the next 13 characters? Will the length actually be wrapped in []? If ya have boost installed use boost::regex for the simplest way. You might be able to use... |