Forum: Assembly Nov 23rd, 2008 |
| Replies: 2 Views: 550 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,... |
Forum: C++ Nov 13th, 2008 |
| Replies: 8 Views: 414 I'm stunned. Can somebody tell me if bracket section alone is by C/C++ standard?
Because, DevC++ mingw and Visual C++ Express 2008 both compile and execute properly:
#include <iostream>
int... |
Forum: C++ Nov 13th, 2008 |
| Replies: 8 Views: 414 AFAIK brackets can be used without any function or if statement, simply as code-block.
They just come in handy for functions, classes, etc. |
Forum: C Nov 13th, 2008 |
| Replies: 13 Views: 786 Please post entire code, because your code should work then. |
Forum: C Nov 13th, 2008 |
| Replies: 13 Views: 786 You have to do it for EACH i.
So put it in for loop |
Forum: C Nov 13th, 2008 |
| Replies: 13 Views: 786 Oh, yes... Your temp is actually same memory space as ptr. So:
temp[0] = ptr[99]
...
temp[99]=ptr[0]
But ptr[0] is temp[0], which is actually ptr[99]
You have to make a REAL copy of ptr to... |
Forum: C Nov 13th, 2008 |
| Replies: 13 Views: 786 I apologise, my bad (still early in the morning here :) )
I just realised that you decrease ptr_size2, not ptr_size, so it shouldn't be problem there. |
Forum: C Nov 13th, 2008 |
| Replies: 13 Views: 786 I only gave you an idea... Probably I messed up some interators, so in some point you call temp[negative]...
Check for this, it shouldn't be hard |
Forum: C Nov 13th, 2008 |
| Replies: 13 Views: 786 Problem is you are going both ways!
You are incrementing i iterator and at same time decrementing ptr_size2.
Write something like:
ptr_size2 = ptr_size;
temp = ptr;
while (ptr_size2>=0) {... |
Forum: C++ Nov 13th, 2008 |
| Replies: 5 Views: 378 What do you really want? How to create Clist? or? |
Forum: C++ Nov 13th, 2008 |
| Replies: 9 Views: 904 What have you done so far? We don't solve homeworks |
Forum: C++ Nov 12th, 2008 |
| Replies: 5 Views: 548 What does Earray point to? You've made it to null pointer:
Earray[i] = 0 //like NULL
And your EmpPointer is unused...
Seems like to me you're trying to allocate 2D array of some sort, but doing... |
Forum: C Nov 12th, 2008 |
| Replies: 5 Views: 514 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. |
Forum: C++ Nov 11th, 2008 |
| Replies: 4 Views: 1,013 why do you need kbhit? kbhit works more like a detector if key is pressed, it doesn't wait for keypress.
Simply use getch? |
Forum: C++ Nov 11th, 2008 |
| Replies: 15 Views: 2,922 Please post at least head of your header file...
Until then, this: googleing! (http://msdn.microsoft.com/en-us/library/f6xx1b1z(VS.71).aspx)
says this: |
Forum: C++ Nov 11th, 2008 |
| Replies: 2 Views: 1,248 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... |
Forum: Assembly Nov 8th, 2008 |
| Replies: 2 Views: 798 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 |
Forum: Assembly Nov 8th, 2008 |
| Replies: 0 Views: 510 Hi! I have the following code:
mov al, 5d
neg al
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... |
Forum: C++ Nov 8th, 2008 |
| Replies: 4 Views: 1,697 Make pointer to pointer **ptr, and allocate n pointers to it.
Then to each of that n pointers *ptr[i] allocate n int's (or whatever).
After that you can use it as regular 2D array: ptr[i][j] |
Forum: Assembly Nov 5th, 2008 |
| Replies: 1 Views: 485 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... |
Forum: C Nov 3rd, 2008 |
| Replies: 10 Views: 776 You can drive your car without fastening seat belt, or walk through minefield :)
But it's risky!
So always use int main() and return zero if succesful (in which case you don't even need to write... |
Forum: C++ Nov 2nd, 2008 |
| Replies: 8 Views: 659 What you wrote will only chage 101'th element of array1 with 101'th element of array2.
To copy arrays, you have to write function that will do that for each element |
Forum: C++ Nov 2nd, 2008 |
| Replies: 3 Views: 336 Let's say you have arrays:
int arr1[N], arr2[N];
Then arr1 and arr2 are actually pointers to first locations in arrays, so this would be true:
arr1== &arr1[0]
&&
arr2==&arr2[0] |
Forum: C++ Nov 2nd, 2008 |
| Replies: 3 Views: 761 If I'm not mistaken, fillellipse draws standard (unrotated) ellipse, and there's nothing you can do to rotate it. You could try to draw your own ellipse, and then do something with that... |
Forum: C++ Nov 2nd, 2008 |
| Replies: 3 Views: 448 Using '%' and '/' should be sufficent. First take a modulo 10 of number (and that is your last digit), then divide number by 10 (and you are left with number without last digit). And put that somehow... |
Forum: C Nov 2nd, 2008 |
| Replies: 4 Views: 1,156 And a little piece of advice. When working with decimal numbers, don't use float, instead use more precise double. |
Forum: C++ Oct 31st, 2008 |
| Replies: 2 Views: 509 Also, when working with classes that allocate memory dynamically, you HAVE to write destructor that will free all allocated memory! |
Forum: C++ Oct 30th, 2008 |
| Replies: 8 Views: 473 Oh yes, sorry. I thought minus was problem :)
Check your spelling, and learn how to read errors. |
Forum: C++ Oct 30th, 2008 |
| Replies: 8 Views: 473 - radius = r;
Hmm...
What's wrong with this code:
-a = 300; |
Forum: C++ Oct 29th, 2008 |
| Replies: 8 Views: 597 Try to see if the problem is input or your class.
Remove all user inputs from main and put something yourself in it. If it works, problem is only in input. |
Forum: C Oct 26th, 2008 |
| Replies: 10 Views: 2,262 Do you know why do you use typedef?
It's syntax should be:
typedef some huge type A_DEF;
And the code you wrote has no use from typedef since you haven't specified name that will replace... |
Forum: C Oct 26th, 2008 |
| Replies: 10 Views: 2,262 Funny:
typedef struct node {
char value;
bool isroot;
bool isend;
struct node* sibling;
struct node* child;
}; //<== if semicolon goes here, it's much more reasonable |
Forum: C Oct 25th, 2008 |
| Replies: 2 Views: 501 What doesn't seem to work? |
Forum: C++ Oct 25th, 2008 |
| Replies: 8 Views: 1,144 So, that's the thing! I knew something was wrong with it, but still :) |
Forum: C++ Oct 25th, 2008 |
| Replies: 9 Views: 563 Why don't you check if it's open?
current_file.open(file.c_str());
if (!current_file){
cout<<"File not opened!\n"
return "";
} |
Forum: C++ Oct 24th, 2008 |
| Replies: 8 Views: 1,144 Glad you've find answer. But this is what you asked (be careful what you ask :) ): |
Forum: C++ Oct 24th, 2008 |
| Replies: 8 Views: 1,144 Don't know if it helps. I myself am not sure if it's ok to write it, but compiler doesn't complain:
void func(int n){
int a[n];
for (int i = 1; i <= n; i++) a[i+1] = i*i;
for (int i... |
Forum: C++ Oct 24th, 2008 |
| Replies: 5 Views: 409 d is c++ string object, and printf is C function.
Even more, not only it's C function (it would probably work nevertheless), but you've told it to print integer ( "%d" tells printf to print integer!) |
Forum: C++ Oct 24th, 2008 |
| Replies: 9 Views: 563 And what exactly is the problem?
You have no syntax errors, and I can't see anything wrong. But i'm sleepy, so maybe I'm wrong...
Please be more specific |
Forum: C++ Oct 24th, 2008 |
| Replies: 15 Views: 957 Ah, now you've said your problem. Solution is simple:
AND && (notice, two & signs)
OR ||
NOT ! |