Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes, as always, you are right. I stand corrected. The link I posted shows the POSIX file descriptors, which are different then FILE handles.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>>fflush (0);
>That is non-standard
No, it's well defined by the standard. If the argument is a null pointer, all open output streams are flushed.

true, fflush(stdout) is well defined, 0 is stdin not stdout

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>ya i knew that but how i use atl function
There is no such atl function equivalent. Just use the win32 api function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you sait you have to use vector, just replace the array with a vector as mentioned before. If you don't want number_used then delete it from the program. Give it a try and repost your most recent attempt at solving the problem.

vector<int> sample_array;
sample_array.resize(10);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what's even more supprising to me is that the baby's grandfather bought him a shotgun as a gift :S

You know you are a rednick when your 15 month old son has his very own shotgun

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You will have to post your code because it is kind of hard for me to see your monitor :)

And don't double post

Aia commented: Willing to bet that we will not see any code? +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You don't use SendMessage() to post to a different thread -- use PostThreadMessage() instead

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what do you mean by tertiary ? It has several meanings, including the age of dinosaurs, or chemestry, or the third of something. I can only assume you mean it to be the third of something, but you used it twice in the description of the program.

what is the incomplete loop at line 15 supposed to do? Looks like it only sets the value of highestgrade10 to the same number 100 times.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

c++ has a sort() function, all you have to write is a comparison function. Here is a short tutorial

If you want to keep all the code you have already written, just replace the array with a vector, then call the vector's resize() method to initialize it to contain 10 elements. I think the rest of the program should work without change.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Does anyone else want them back as well?

No, can't say that I would find them useful. I do, however, use "Posts Since Last Visit" and "Todays Posts" a lot.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you use c++ ifstream or fstream class you can use getline() to get the entire line

ifstream in("filename");
std::string line;

while( getline(in,line) )
{
   // blabla
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Good question. Show me where it happened
It is one of the reps for Stein. Since rep comments are now public we need to be more careful what we say there.

>>where was wolfpack's infraction for calling christina a b****?
mods can not infract other mods, and comments in reps can not be infracted directly.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Thanks, but if it will slow things down it probably won't be worth it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

sprintf() will do it -- the format string is "%x" or "%X"

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is it possible for the popup to show the last post in the thread instead of the first post ? Or make it an option in CP? Often I'm more interested to read the last post.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>"you are an idiot for posting this thread."
I don't think so -- its a valid topic to discuss. Maybe the solution you posted isn't the smartest solution, but we can't blain the messenger :)

christina>you commented: thank you +9
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you probably need to add more braces, like this, and don't put braces on the same line as other code because it makes the program moe difficult to read and understand. Strive for clarity, not cuitness.

int main()
{
   for(int i=0;i<=7;i++)
   {
        for(int j=0;j<=i;j++)
        {
            cout<<'*';
            for(int k=0;k<=i;k++)  
            {
                   cout<<' ';
             }
        }
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you will have to be a little more specific. Do you get compile errors? If yes, that are the errors?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

this could be true, and probably is true. but it could be the message we send that does the most good.

you are just kidding yourself if you think that will do any good. Its been tried before and nothing at all happened to gas prices. Big oil companies could care less what we the consumer think -- they can charge anything they want and we are stupid enough to pay it. $3.00 per gallon is nothing compared to european prices. Last time I heard it was over $10.00/gallon in UK.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

hello ,

first i want to say that im very new at c++ , i managed to create a very simple program through searching the internet , this little program involves running a certain exe file with parameters :

(e.g: "c:\folder\file.exe" -parameter1 -parameter2)

i am using the system() function to do that so my code looks something like

string x;
x = "\"c:\\folder\\file.exe\" -parameter1:value1 -parameter2:value2";
system(x.c_str());

so it would run this command ( "c:\folder\file.exe" -parameter1:value1 -parameter2:value2 )

it works fine untill one of the parameters values must include quotes in it like this ( -parameter:"value" )

so when i type the code like this

string x;
x = "\"c:\\folder\\file.exe\" -parameter1:\"value1\"";
system(x.c_str());

i get the error :

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.


but if i put the same command line ( with the quoted value of the parameter ) in the windows run , or in CMD , it would work fine, why do i get the error when i try to run it from the system() function ..?!!


i appereciate any help.

Check the quotes in the line you posted, there are too many of them. -- remove the quotes at the beginning of the string and after file.exe. It should be something like this (I tested it and it works)

system("\\dvlp\\file.exe -parameter1:value1 -parameter2:\"value2 with spaces\"");
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

worst-case scenario -- you will need a computer with lots of horse power, probably multiple processors to handle that many clients all at the same time and linux os is better at that then MS-Windows. I have no experience writing web servers, so I can't really give any more advice. I would think you will get better answers in the Web Development board.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think a web server would be better coded in another language -- probably php or even C#, which are designed for that sort of stuff.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

maybe they mean the circumfrenece of the circle that surrounds the triangle ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't mean to say we should respect criminals -- from what I understand prison life can be pretty tough, and that child molesters don't live very long there. But I don't know that for a fact because I've never been there except on a grade-school tour. Putting someone in prison for life would be a lot more punishment then the death penalty.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Circumference of a Triangle ? WTF !!!

Didn't you learn anything in school -- its a tringle with rounded corners:)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I didn't like line numbers at first either but I have grown to like them because they make it very easy to dicsuss specific lines in the posted code. Its a lot easier and safer to reference a line number then it is to quote the line and hope the OP can find it in his code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No, but I switched using CP a couple weeks ago. Only noticed the problem for the first time when I started this thread. Never used the 'A' icon before.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That doesn't mean society has to degrade itself into the sewer where the criminals live. Just because they commit horrible crimes doesn't mean we have to be like them.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to copy from a previous post -- I highlighted the code the OP posted with my mouse then copied it into the clipboard. Then pasted it into the quick edit box.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This just started after changing the colors and code tags yesterday. Copy some code and paste it into the Quick Reply box, then hit Go Advance button. All the line feeds and spaces are lost, eveything is now on one line and I have to manually replace all line feeds, spaces and tabs. I just now noticed the problem in this thread.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you should not mix C and C++. In C++ use cin.ignore() to pause the program instread of C getchar(). And you don't need stdio.h either.

#include <iostream>
using namespace std;
int main ()
{ 
    cout << "Hello World"; 
    cin.ignore();
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you are using ms-windows operating system you can include windows.h which already defined BYTE and WORD. If not then you can define them yourself like this

typedef unsigned char BYTE;
typedef unsigned short WORD;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Apparently the crucifictions was not much of a deterrent because people still, after 2,000 years, commit the same crimes. And even today people still commit the same crimes over-and-over knowing full well what the penalty is. As much as I'd like to agree with Dcc's punishment, that would make us not any better then the sex offender. Preventing cruel and inhuman punishment is not meant for the criminal but to prevent society from degrading to lawlessness. We as society need to respect each other instead of treating everyone like a bunch of thugs. The movie Escape From New York comes to mind.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are many options available to you. Personally, I would suggest using classes over structs in c++, as you can also define private member functions. .

In c++ structures are nearly identical to classes, but yes a formal class would be preferable. structures can have private members too, just like classes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

does Emp.set() copy name into another class variable? If it does then you don't neet 6 or 19, but you can use string's c_str() method instead to pass a char* to that function, like this:

Emp[B][[/B]numEmp[B]][/B].set[B]([/B]id, tempName.c_str(), rate, dep, type[B])[/B];

I think you will need to post the rest of your program so we can see class declaration and other code. What you posted appears to be ok so the problem is probably elsewhere.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>fflush (0);
That is non-standard, should be fflush (stdout); . Any attempt to use fflush() on an input stream like stdin will result in undefined/unpredictable behavior.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Isn't it odd that the problem asks for the number of men, number of women, and the number of hetrosexuals as if hetrosexuals are neither men nor women :scared: I never new there was a third sex in the human race.

Aia commented: LOL +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I really like the new colors, for me it makes it a lot easier to read the code. Now, if you could only somehow force the newbes use the code tags;)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ooooooo! Haaaaa! I really like the new color of the code tags. Great job Dani.:)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Too bad you don't filter out the color tags that sometimes appear in C/C++ posted code -- I mean the color tags that appear to be embedded by some automated text editor, like [ color=0x001234 ]. These are pretty combursome to manually remove.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I thought F meant Friend.

I changed CP to show dates/times as they originally were here. But I've become so acustome to seeing Yesterday or Today that I changed it back! I like not having to think about anything. :-O

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

start loop that counts from 0 to 100
print first question
ask for answer

repeat above for each question
end of loop

what is your gender
1. m if male
2.f if female
3.h if hetero

hetro is not a gender -- its a sexual preference. So only 1 and 2 are the only two possible answers to that question, unless I've slept too long.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't like color in people's posts -- its too distracting. If I want to emphasize someting I normally make it bold or italic or both. Only in very rare occations will I use RED when posting/correcting C/C++ code and then only to show suggested changes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I like it the way it is now -- especially the line numbers. The only language syntax I've used is C, such as [ code=c ], which isn't very difficult to type. As for the box, yes I miss that too but I can live without it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Diablo II (or any other version of Diablo for that matter) by Blizzard can not be played on Vista os -- I tried it and it doesn't work :( . There are a lot of old games that are not compatible with Vista. If the mouse on your computer works ok with other games that come with Vista then I doubt there is anything wrong with your computer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Line 3 can be deleted because the stream's extraction operaotr >> will ignore all white space (spaces and tabs) between words.

Line 4: you don't want to use getline() here because it reads the entire line, not just the next two words. If the name is always in the format you show then its probably better and easier to use the extractions operator >> to read the first name and last name separately.

string firstName,lastName;
empFile>> firstName >> lastName;
// now concantinate them together
string name = firstName + " " + lastName;

line 5 should work ok if you make the above changes

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you have any sort of sound elsewhere like startup noises etc. or is it just no sound all together?

Try checking in your driver list and making sure that your audio drivers are installed properly.

Yes I have normal sound when playing games and playing audio DVD/CD's.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>i did that but i am still comeing up with errors except these errors that are coming up shouldnt be there

what are the errors? Compilers do not produce errors unless there are infact errors. For example: look at lines 63-66. Line 66 is an error because of missing braces to enclose lines 64 and 65 in the same block.

Line 74: two problems here. (1) using the '=' assignment operator instead of "==" boolean operator (very common mistake), and (2) missing semicolon at the end of the line.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

its telling you that scores.size() is greater than 4, which is out-of-bounds.