Forum: C++ Mar 22nd, 2009 |
| Replies: 4 Views: 254 okay I see,
and yeah I guess the phrasing was a bit loose... but with a char array,
you can define it char x[]="rawrawrawrawrawr"; or char *x="rawrawrawrawrawr"; and have it behave the same, no?... |
Forum: C++ Mar 21st, 2009 |
| Replies: 4 Views: 254 I'm unsure of how declaring **x (a pointer to a pointer of x) is the same as declaring x[][] (a two-dimensional array of x's)... The theory I have is this:
int *x = {whatever}; (x is a pointer to... |
Forum: C++ Mar 14th, 2009 |
| Replies: 9 Views: 409 > Well, according to me: Its the knowledge about language that counts rather than what tools/text editor you use.
yeah, good point.
Also, I may have to give Code::Blocks a try, it looks pretty... |
Forum: C++ Mar 14th, 2009 |
| Replies: 9 Views: 409 why not? It is a forum... and I tried learning emacs but it got old quickly, I prefer using vim on *nix |
Forum: C++ Mar 14th, 2009 |
| Replies: 5 Views: 328 yeah, I know it's definitely a no-no, I just thought it was kind of cool, being able to cheat the compiler. Get back at it, for all these years of yelling at me, and telling me how wrong I am. Take... |
Forum: C++ Mar 13th, 2009 |
| Replies: 9 Views: 409 What editor/compiler does everyone use,
and,
what is your syntax highlighting like?
I'm using programmer's notepad 2, with a gcc win32 port...
with a stylish green-identifier, gray-text,... |
Forum: C++ Mar 13th, 2009 |
| Replies: 2 Views: 354 wrap this in tags, with indents. And what do you mean you "want to match void getdata() and void stock()"? |
Forum: C++ Mar 13th, 2009 |
| Replies: 5 Views: 328 #include<iostream>
using namespace std;
int main(){
int a;
int b;
asm("jmp c\n\t"); |
Forum: C++ Mar 9th, 2009 |
| Replies: 4 Views: 627 okay, thanks--and I figured out the scope pretty quickly, it's weird how if you
int z;
{
z=5;
}
then the z refers to the z outside the braces, but if you
int z; |
Forum: C++ Mar 9th, 2009 |
| Replies: 4 Views: 627 Well, I don't know if this is what you would call an anonymous function, or "Lambda" function I guess, I haven't really gotten that far into languages that use them yet...
but, I am writing a... |
Forum: C++ Feb 19th, 2009 |
| Replies: 12 Views: 646 I already marked it as solved, but just letting you know I got it all working, and I understand all the code now--thanks for the help, I learned a lot more about classes. |
Forum: C++ Feb 19th, 2009 |
| Replies: 12 Views: 646 awesome, thanks a lot for your help |
Forum: C++ Feb 18th, 2009 |
| Replies: 12 Views: 646 well it works really well but there is some syntax here that I don't completely understand...
virtual void saveMessage(const char* pmsg) = 0;
virtual means that the child class will inherit this... |
Forum: C++ Feb 18th, 2009 |
| Replies: 12 Views: 646 sounds perfect... how would I declare a pointer in the A class though?
Like, would I just go B &errorTarget;?
or would I use the * operator? The most I've really worked with pointers so far is in... |
Forum: C++ Feb 18th, 2009 |
| Replies: 12 Views: 646 In my example code above,
if I called something.someObject[2].setErrorMessage("BIG ERRAR!");,
and then in A::setErrorMessage(char*), used the this operator, would "this" refer only to someObject[2]... |
Forum: C++ Feb 18th, 2009 |
| Replies: 10 Views: 465 hey thanks, I wondered how others did it.
Also, flame wars might be appropriate considering your avatar.
Also, back to the original problem in the thread,
Not everybody is going to have the same... |
Forum: C++ Feb 18th, 2009 |
| Replies: 7 Views: 463 in your first post, you need to end the class with a ; after the closing brace
class name {
...
};
you would access it by creating an instance of the class in a declaration,
class clName{... |
Forum: C++ Feb 18th, 2009 |
| Replies: 10 Views: 465 lol oh noz progamming flame warz |
Forum: C++ Feb 18th, 2009 |
| Replies: 12 Views: 646 lol what's bad about it? I put it in that order because class A has to be known before I can declare an object of type A in class B, the classes need to interact with each other, that is my problem.... |
Forum: C++ Feb 17th, 2009 |
| Replies: 12 Views: 646 but there is a need for class A to be in class B |
Forum: C++ Feb 17th, 2009 |
| Replies: 10 Views: 465 it's a syntax error, the compiler will tell you what line it's having a problem with. Take that line of code, or the procedure that line of code is in, wrap it in [ code=cpp] [ /code] tags (without... |
Forum: C++ Feb 17th, 2009 |
| Replies: 12 Views: 646 so say I have something like this:
#include<iostream>
class A{
public:
void setErrorMessage(char*); |
Forum: C++ Feb 16th, 2009 |
| Replies: 6 Views: 460 |
Forum: C++ Feb 14th, 2009 |
| Replies: 4 Views: 615 How would I write a function with an undefined number of arguments?
Like, how when using printf(), you write the string in the first argument and in the string use format identifiers. Then, for each... |
Forum: C++ Feb 14th, 2009 |
| Replies: 6 Views: 460 but you said where the variable is stored depends on where it is declared/initialized |
Forum: C++ Feb 14th, 2009 |
| Replies: 6 Views: 460 "> variable2="hello world!"
Bad news!
The heap memory you had has now leaked (you lost your last pointer to it). "
I thought this would put "Hello world!" into the heap memory...
would I have to... |
Forum: C++ Feb 14th, 2009 |
| Replies: 6 Views: 460 So, I'm dynamically allocating a char array in a function, then returning that array to an un-allocated char array in main().
Code:
#include<iostream>
using namespace std;
char*... |
Forum: C++ Feb 13th, 2009 |
| Replies: 9 Views: 442 I suppose you could just make printdetails use cout.
void printDetails(dog dogObj){
cout << "The dog is " << dogObj.getAge() << " years old." << endl << endl;
cout << "Dog's Gender?: " <<... |
Forum: C++ Feb 13th, 2009 |
| Replies: 9 Views: 442 if it's working, you should mark the thread as solved, it's my first one :)
also, use [ icode] just for inline code like this, but if you're pasting C++ code, use [ code=cpp] ... [ /code] and it... |
Forum: C++ Feb 13th, 2009 |
| Replies: 5 Views: 305 Here is what I wrote,
#include<iostream>
using namespace std;
int main(int argc,char**argv){
int siz=0,i=0,n; |
Forum: C++ Feb 13th, 2009 |
| Replies: 9 Views: 442 The problem with the char is this line:
davesDog.setGender("M");
"M" is a character array,
you are passing the letter M and a NULL character ('\0') to the setGender function (the NULL character... |
Forum: C++ Feb 13th, 2009 |
| Replies: 7 Views: 414 Ah, based on what Chris said, I thought I had to delete it one dimension at a time... I suppose I could just look and find out for myself somehow.
And, this out-of-bounds thing--will the system... |
Forum: C++ Feb 13th, 2009 |
| Replies: 7 Views: 414 okay thanks, I got it working--although, why am I able to go,
var[x][y][i+6]='p'; after the loop completes? shouldn't this generate some kind of error? Segmentation fault? Since I would be going... |
Forum: C++ Feb 13th, 2009 |
| Replies: 7 Views: 414 I get the error "Cannot convert char* to char**",
it's a three dimensional array,
var[x][y][z]
where x is the number of groups of strings,
y is the number of strings in group x,
and z is the... |
Forum: C++ Feb 13th, 2009 |
| Replies: 7 Views: 414 So I got past my last problem using new[],
but now I seem to have a new one...
I created a char***, var.
The goal was to build each dimension of the array to be different sizes at different times,... |
Forum: C++ Feb 8th, 2009 |
| Replies: 3 Views: 224 I have no idea... I just thought **a was the same as a[][], like a two dimensional character array, an array of strings, etc.
I'm not sure what I did wrong, I'm not totally literate with using... |
Forum: C++ Feb 8th, 2009 |
| Replies: 3 Views: 224 I'm trying to use new but I can't seem to get it right...
in this example I ask how many strings the user would want to input, then ask for each one, then echo them back.
#include<iostream>
... |
Forum: C++ Feb 8th, 2009 |
| Replies: 2 Views: 206 |
Forum: C++ Feb 8th, 2009 |
| Replies: 2 Views: 206 I'm trying to write a class that will read and organize the command line arguments of a program.
Like, it will read -a as a 'switch', and --abcd as a 'switch' and you can define different switches... |
Forum: C++ Feb 4th, 2009 |
| Replies: 4 Views: 333 anyone know just the basics of compiling a dll which exports a class and a function? Just like a short code? Also how to write the exports file |