Search Results

Showing results 1 to 40 of 66
Search took 0.01 seconds.
Search: Posts Made By: Clockowl
Forum: C++ Apr 18th, 2009
Replies: 4
Views: 442
Posted By Clockowl
Is it a Windows handle, the one in windows.h? It's not an initializer, it's what int and char are: a type.

If it's a window handle, it's basically as specific as a pointer. A pointer used by...
Forum: C++ Apr 18th, 2009
Replies: 3
Views: 299
Posted By Clockowl
You can look all that info up in a STL List reference, as the one found here:

http://www.cplusplus.com/reference/stl/list/

See the "STL Algorithms" for sorting data inside STL containers.
Forum: C++ Apr 17th, 2009
Replies: 13
Solved: Compiling C++
Views: 683
Posted By Clockowl
Erm. I guess it can be compile in MSVC++. You can try to install MSVC++ Express and grab the platform SDK. Google is your friend. Can anybody else compile this code?
Forum: C++ Apr 16th, 2009
Replies: 7
Views: 437
Posted By Clockowl
Example of inheritance using virtual functions:

#include <iostream>
using namespace std;

class base {
public:
virtual void func(){
cout << "First level: Base class" << endl;...
Forum: C++ Apr 16th, 2009
Replies: 7
Views: 437
Posted By Clockowl
class Client
{
public:
string name;
Menu order;
int table_number;
string type;
double bill;

Client(void)
Forum: C++ Apr 16th, 2009
Replies: 29
Views: 1,400
Posted By Clockowl
Errr, ignore that last part. Sometimes I'm unclear.

Student student;
for(int subject = 0; subject < 4; subject++){
string code;
int cu;
char pass_or_fail;
inFile >> code;
...
Forum: C++ Apr 16th, 2009
Replies: 29
Views: 1,400
Posted By Clockowl
No, student already has 4 subjects: use those.


Student::Subjects::setVar();
Forum: C++ Apr 16th, 2009
Replies: 29
Views: 1,400
Posted By Clockowl
That sucks. But still, just loop the student array then, one time for input, one time for output. So no more extra variables representing members in class Student! ;)
Forum: C++ Apr 16th, 2009
Replies: 29
Views: 1,400
Posted By Clockowl
You could create a function that accepts a reference to a student and outputs it's data?


void output_student(Student &stud){
//put the output code here
}
//....
int main(){
//loop each of...
Forum: C++ Apr 16th, 2009
Replies: 29
Views: 1,400
Posted By Clockowl
Totally wrong approach buddy. Create 4 students, read out their data.

Example code:

cout << students[0].getVar() << endl;


Kinda like that.
Forum: C++ Apr 15th, 2009
Replies: 7
Views: 351
Posted By Clockowl
Good luck with the assignment, don't forget about the STL! (It has a queue, of course you can't use that, but it has plenty of other useful containers and algorithms).
Forum: C++ Apr 15th, 2009
Replies: 7
Views: 351
Posted By Clockowl
If you're standing in queue line at the grocery shop, does the LINE look like a tree, with intersections and such, or more like an array of (possibly annoyed) customers?

I sure hope it doesn't...
Forum: C++ Apr 15th, 2009
Replies: 13
Solved: Compiling C++
Views: 683
Posted By Clockowl
It doesn't compile in MinGW's GCC. Looks like MSVC code?

I'm getting these errors:

=|
sdvrp.h|18|warning: ignoring #pragma warning |
sdvrp.h|222|warning: no newline at end of file|...
Forum: C++ Apr 15th, 2009
Replies: 11
Views: 787
Posted By Clockowl
Oh it does you no good, but you can't really check for !file, since file would be.. something. Although it "worked", maybe by accident.

Anyway, Could you hardcode the path, "C:\test.txt", and put...
Forum: C++ Apr 15th, 2009
Replies: 11
Views: 787
Posted By Clockowl
Wait, doesn't the fstream constructor *always* create something? Check if file.good() is true.



Oh and, don't open it twice. In the constructor OR with fstream.open(), not both.
Forum: C++ Apr 15th, 2009
Replies: 11
Views: 787
Posted By Clockowl
Hurr, it might be a really stupid "error".

One time (at band camp, xD) I was trying to open a file from an app I wrote in Code::Blocks on windows. So I put that file in project/bin/debug/, but...
Forum: C++ Apr 15th, 2009
Replies: 29
Views: 1,400
Posted By Clockowl
Yeah, but keep in mind he didn't design the functions himself, his prof did it for him. He needs to use these functions, unaltered, I think.
Forum: C++ Apr 15th, 2009
Replies: 9
Views: 491
Posted By Clockowl
On my dualcore processor, 2 cores where in use and it indeed didn't give any errors as stated earlier. This is on Windows XP x64.
Forum: C++ Apr 15th, 2009
Replies: 9
Views: 491
Posted By Clockowl
Okay, not 100% right. Darnit. xD

I've just created a single multithreaded program and it was (a dreaded task and) crashing constantly! So I ended up creating mutexes for every "group" of shared...
Forum: C++ Apr 15th, 2009
Replies: 29
Views: 1,400
Posted By Clockowl
"Set pass/fail" I guess? Maybe the int is the subject indicator? Ugh, the variable names are horribly chosen. Just use that int as subject index and the char as.. P or F or something? Or grades? I...
Forum: C++ Apr 15th, 2009
Replies: 9
Views: 491
Posted By Clockowl
MrSpigot was 100% right, my bad. You don't need mutexes to write and read from one variable at the same time.

Tested with:


#include <iostream>
#include <windows.h>
using namespace std;
...
Forum: C++ Apr 15th, 2009
Replies: 9
Views: 491
Posted By Clockowl
That's wrong, almost 100% sure, couldn't make sure with google, but it's just 2 threads trying to access the same memory: doesn't matter if they read or write, both will lead to errors.

Agreed on...
Forum: C++ Apr 15th, 2009
Replies: 3
Views: 550
Posted By Clockowl
Sure, it looks fine, but you need to write it yourself if you want to learn C++, not somebody else.

I mean, do you know what this &*(array + k) does? (It looks rather redundant...)
Forum: C++ Apr 14th, 2009
Replies: 3
Views: 550
Posted By Clockowl
What doesn't work?

new doesn't set the allocated memory to 0, could that be a problem?

Be a bit more specific please.
Forum: C Apr 14th, 2009
Replies: 19
Solved: array help
Views: 690
Posted By Clockowl
Give it a shot here: http://www.cplusplus.com/doc/tutorial/

When you're stuck on a tutorial, you can ask for help of course.
Forum: C++ Apr 14th, 2009
Replies: 29
Views: 1,400
Posted By Clockowl
Haha, no, that function of course needs to know what subject to set. Change it a bit, add a comment for your prof? The other functions do have such a parameter, so maybe he forgot?
Forum: C++ Apr 14th, 2009
Replies: 29
Views: 1,400
Posted By Clockowl
// set the subject grade (pass or fail)
void Student::setSpf(char score,int grade)
{
}

How does that function know what subject it is supposed to work on?
Forum: C++ Apr 13th, 2009
Replies: 8
Views: 274
Posted By Clockowl
xD Okay, sorry. I'd suggest sqrt() nonetheless, but it doesn't really matter.
Forum: C++ Apr 13th, 2009
Replies: 8
Views: 274
Posted By Clockowl
He means the sqrt() function.
Forum: C++ Apr 13th, 2009
Replies: 8
Views: 274
Posted By Clockowl
And, not related to programming, you're squaring it, not square rooting it.
Forum: C++ Apr 12th, 2009
Replies: 29
Views: 1,400
Posted By Clockowl
A small addition:
Sometimes set functions do return something, and most of the time that's whether they succeeded or not.

Anyway, seeing the format, it's like this:

<name>, list(<subject>,...
Forum: C++ Apr 12th, 2009
Replies: 29
Views: 1,400
Posted By Clockowl
while(!inFile.eof())
{
// use getline to read entire line
getline(inFile, s);
cout << s << endl;
}

That's wrong code. eof gets set when it has read eof, so and...
Forum: C++ Apr 11th, 2009
Replies: 3
Views: 333
Posted By Clockowl
while(firstTry == true)
{
{
cout << "It Is Your First Try, We Will Create My Array First:\n";
updateArr(arr, size);
}
return firstTry = false; //Don't return here, hehe.
}
Forum: C++ Apr 10th, 2009
Replies: 4
Views: 436
Posted By Clockowl
From the reference: (http://www.libsdl.org/cgi/docwiki.cgi/SDL_keysym)

"... The unicode field is only used when UNICODE translation is enabled with SDL_EnableUNICODE. ... "

I suppose you did...
Forum: C++ Apr 10th, 2009
Replies: 4
Views: 436
Posted By Clockowl
Maybe make sure that conversion is going alright?

Output (char) (event.key.keysym.unicode) or something.

ASCII chars in UTF-8 might be something like, {\x00\x<ASCII-code>}, in that case,...
Forum: C++ Feb 19th, 2009
Replies: 3
Views: 957
Posted By Clockowl
newnode = new Node;
newnode = NULL;


Eerrrr? That's a bit of weird code. You're trying to derefence that pointer on the next line! ;)
Forum: C++ Jan 3rd, 2009
Replies: 5
Solved: help needed
Views: 315
Posted By Clockowl
Here are two examples I created and use as a reference, maybe they are of help:


/*
** Playing around with WinSockets
*/

#include <stdio.h>
#include <winsock.h>
Forum: C++ Jan 3rd, 2009
Replies: 5
Solved: help needed
Views: 315
Posted By Clockowl
First post!

Read the sticky at the top of the forum?
Forum: C Nov 23rd, 2008
Replies: 5
Views: 1,964
Posted By Clockowl
Nah I just meant to say that if you're sure that you'll only use it on your system, why not use those compiler specific functions? I think it's overkill to make basically everything you create cross...
Forum: C Nov 23rd, 2008
Replies: 5
Views: 1,964
Posted By Clockowl
I'm more of a newb but feeling cocky as always:

Don't AVOID compiler specific functions, but be sure to find a cross-compiler way to do it as well, as in: find it, use it a couple of time,...
Showing results 1 to 40 of 66

 


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

©2003 - 2009 DaniWeb® LLC