Search Results

Showing results 1 to 40 of 206
Search took 0.02 seconds.
Search: Posts Made By: Sci@phy ; Forum: C++ and child forums
Forum: C++ Nov 13th, 2008
Replies: 8
Views: 450
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
What do you really want? How to create Clist? or?
Forum: C++ Nov 13th, 2008
Replies: 9
Views: 948
Posted By Sci@phy
What have you done so far? We don't solve homeworks
Forum: C++ Nov 12th, 2008
Replies: 5
Views: 633
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
- radius = r;

Hmm...
What's wrong with this code:
-a = 300;
Forum: C++ Oct 29th, 2008
Replies: 8
Views: 629
Posted By Sci@phy
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
Posted By Sci@phy
So, that's the thing! I knew something was wrong with it, but still :)
Forum: C++ Oct 25th, 2008
Replies: 9
Views: 602
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Solved: And or not
Views: 993
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
Line 30: return 0; should be inside main function
Forum: C++ Oct 23rd, 2008
Replies: 2
Views: 414
Posted By Sci@phy
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
Posted By Sci@phy
Have a look:
set (http://www.cplusplus.com/reference/stl/set/)
Forum: C++ Oct 22nd, 2008
Replies: 11
Views: 840
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
Umm, your code?
Forum: C++ Oct 20th, 2008
Replies: 2
Views: 351
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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
Posted By Sci@phy
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...
Showing results 1 to 40 of 206

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC