Forum: C++ Nov 13th, 2008 |
| Replies: 8 Views: 450 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: 450 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: 5 Views: 395 What do you really want? How to create Clist? or? |
Forum: C++ Nov 13th, 2008 |
| Replies: 9 Views: 948 What have you done so far? We don't solve homeworks |
Forum: C++ Nov 12th, 2008 |
| Replies: 5 Views: 633 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 11th, 2008 |
| Replies: 4 Views: 1,095 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: 3,353 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,449 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: C++ Nov 8th, 2008 |
| Replies: 4 Views: 1,956 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: C++ Nov 2nd, 2008 |
| Replies: 8 Views: 743 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: 356 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: 856 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: 496 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++ Oct 31st, 2008 |
| Replies: 2 Views: 538 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: 503 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: 503 - radius = r;
Hmm...
What's wrong with this code:
-a = 300; |
Forum: C++ Oct 29th, 2008 |
| Replies: 8 Views: 629 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 25th, 2008 |
| Replies: 8 Views: 1,280 So, that's the thing! I knew something was wrong with it, but still :) |
Forum: C++ Oct 25th, 2008 |
| Replies: 9 Views: 602 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,280 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,280 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: 432 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: 602 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: 993 Ah, now you've said your problem. Solution is simple:
AND && (notice, two & signs)
OR ||
NOT ! |
Forum: C++ Oct 24th, 2008 |
| Replies: 2 Views: 631 You should check your microphone. It can sometimes be a problem (conflicts with compiler for c++) |
Forum: C++ Oct 23rd, 2008 |
| Replies: 6 Views: 444 because your for loop is counting for you, and still, you are counting for yourself in
if (num%two==zero)
{
sum=sum+num;
ctr++;
} |
Forum: C++ Oct 23rd, 2008 |
| Replies: 6 Views: 444 You should use while loop, not for.
And you haven't declared 'two' and 'zero'.
Why don't you simply put 2 and 0? |
Forum: C++ Oct 23rd, 2008 |
| Replies: 11 Views: 840 do loop. And inside while add check ch != 'q'.
And you have to cleverly put menu printout somewhere inside :) |
Forum: C++ Oct 23rd, 2008 |
| Replies: 11 Views: 840 You don't need two loops (do, and while). Try to implement just one. (think, think :) ) |
Forum: C++ Oct 23rd, 2008 |
| Replies: 7 Views: 1,505 Line 30: return 0; should be inside main function |
Forum: C++ Oct 23rd, 2008 |
| Replies: 2 Views: 414 float monitorhire ( float hireleft,float hireout) ;
This is wrong declaration inside main()!
Advice: don't use so much global variables (none would be best) |
Forum: C++ Oct 22nd, 2008 |
| Replies: 1 Views: 333 Have a look:
set (http://www.cplusplus.com/reference/stl/set/) |
Forum: C++ Oct 22nd, 2008 |
| Replies: 11 Views: 840 You're getting char with cin.get(ch) inside while function. You don't need cin>>ch; before (it steals one char from you) |
Forum: C++ Oct 22nd, 2008 |
| Replies: 2 Views: 369 Guessing game? Well, ok... what kind of guessing game?
And if you really have code, post it, please.
And use code tags! |
Forum: C++ Oct 22nd, 2008 |
| Replies: 9 Views: 970 You have declared y inside for loop, so that means it only exists in for loop. Declare it before for! |
Forum: C++ Oct 21st, 2008 |
| Replies: 3 Views: 472 |
Forum: C++ Oct 20th, 2008 |
| Replies: 2 Views: 351 For hundreth time: you don't call void function like:
void myfunc()
but by simply typing:
myfunc()
And what do you want with divide_by_zero()? |
Forum: C++ Oct 20th, 2008 |
| Replies: 9 Views: 970 double y[41]?
I'm not checking a logic of your program since I don't really know what it's about, but first set your syntax straight, then fix logical errors |
Forum: C++ Oct 20th, 2008 |
| Replies: 4 Views: 1,020 You don't even need that, since you have a number before your matrix that tells you how big it is.
Simply add second number after that, do some sort of while/for/do-while/goto loop (ok, maybe only... |
Forum: C++ Oct 20th, 2008 |
| Replies: 9 Views: 970 Err#1: this semicolon here: double getTheoreticalData(double x);
This is not necesarry:double PI;
Since you have included "cmath" header, you already have M_PI defined, and it's more precise than... |