twomers 408 Posting Virtuoso

Don't forget that you need a ; at the end of your class defn -

class class_name {
  // ...
};

In C when you created a struct and didn't define it with a typedef you'd have to say:

struct struct_name struct_instance_name;

rather than what you'd be used to. However that need is now gone in C++ so you can just do a:

struct_name struct_instance_name;

and it'll be happy out. Now. In the code you posted there the structure is typedef-ed ... In C this would be fine with either of these methods

typedef str {
 // add stuff here
} my_struct;

// ...

my_struct my_inst; // <- OK
struct str my_inst_2; // <- OK

str my_inst_3;// <- illegal

so the typedef omits the necessity for a structure identifier in C, but it's no necessary in structures in C++ nor with classes so you can ignore those last two lines.

twomers 408 Posting Virtuoso

>> I recommend sarcasm tags, in that case.
Heretic!
I find it more amusing not to use them. Especially in real life (vocal inflections are like sarcasm tags).

twomers 408 Posting Virtuoso

So I haven't read this, but there's no mystery to the situation - http://twomers.googlepages.com/ne.PNG

twomers 408 Posting Virtuoso
twomers 408 Posting Virtuoso

I like cigars cause I'm pretentious. Also brandy goes nice with them.

twomers 408 Posting Virtuoso

Shepards or Cottage pie... I can never remember the difference.

twomers 408 Posting Virtuoso

You'd better believe it. And someone recognised me for who I was too, which made my night.

twomers 408 Posting Virtuoso

"Eh... I think I dropped my gun here earlier... did anyone find it?"

twomers 408 Posting Virtuoso

I really don't think it'll affect your either way. I mean. It's 15 const ints...

twomers 408 Posting Virtuoso

Yeah... well some people are special.

twomers 408 Posting Virtuoso

Did you even look at the link I sent? Gah!

http://www.cplusplus.com/reference/clibrary/cstdio/fgets.html

Salem commented: You can lead a horse to water, but you can't make him think! +11
twomers 408 Posting Virtuoso

Do you want to print the contents to your screen or to the file? The way you opened the file there was for writing, that's what the w stands for. I was under the impression that you wanted to read the file. Use r for that. Look into fgets, or fscanf (if memory serves). http://www.cplusplus.com/reference/clibrary/cstdio/fgets.html

twomers 408 Posting Virtuoso

Simple file io. First hit on google - http://www.cprogramming.com/tutorial/cfileio.html. All you need to do is point the file pointer to your desktop. You can hard code that if you want. Then open the file for reading (see link), and print its contents to screen.

twomers 408 Posting Virtuoso

Man I would love a hot toddy right about now.

twomers 408 Posting Virtuoso

I decided to go out in the last minute so I grabbed a cane, a pill box, some tictacs and hey presto I was Dr. House. A buddy of mine went as Predator and another as Awesomeo. Both were excellent but both made it awkward to drink anything!

twomers 408 Posting Virtuoso

Wow. We give out about people not giving us enough code all the time ... but all the code... one would think it's a good thing...
However, I, for one, am not going to look at any of them. I think it's generally said to post the smallest segment of code which illustrates the problem. Please do so. You'll get more responses in my opinion.

iamthwee commented: I would agree with that +13
twomers 408 Posting Virtuoso

I'm likely the fourth born. Close I guess. Sixth.

twomers 408 Posting Virtuoso

See I think football is silly (probably cause I've not watched it much), but I think Rugby is fantastic! Now I'm not saying every game is excellent (it can be tempremental like them all), but the majority of the games I'd watch are worth it.

twomers 408 Posting Virtuoso

switch( x>y ) { ... } ?

twomers 408 Posting Virtuoso

Maybe we could merge this with the brains or body thread...

twomers 408 Posting Virtuoso

My mother is at the moment. I haven't eaten since yesterday. It's my fault. Gad that feels good! I love steak!

twomers 408 Posting Virtuoso

Lardmeister's got a girlfriend!

twomers 408 Posting Virtuoso

Stomach lining (I'm STARVING! Dinner's taking ages)

twomers 408 Posting Virtuoso

I couldn't see it kicking off.
The sports which are popular here have had a long time to sink their talons into the hearts of their fans. American football... may be a passing fad but no more than that, in my opinion.

twomers 408 Posting Virtuoso

>> I started out to prove that pot was a dangerous drug.
I was in a school debate before about a similar topic.... My fundamental arguement was that in 99% (I just made that up now - I can't remember the actual figure), of Irish cases pot is smoked. We all agree that smoking is detremental to ones health, correct? So how can adding thousands of extra chamicals make it any less dangerous. I argued that it was not the drug that made it dangerous but the means in which it was ingested. I think my teachers liked that slant on the topic.

twomers 408 Posting Virtuoso

>> I didn't compile or test this so it might contain errors
Neither using namespace std nor std:: s are there! Neither is iostream. Tut tut tut.

Ancient Dragon commented: thanks for pointing out those errors +20
twomers 408 Posting Virtuoso

I'm sure wikipedia will have something of another on the subject - http://en.wikipedia.org/wiki/Hyperbola

twomers 408 Posting Virtuoso

Do you know how to use file streams in C++? Just create a file, it doesn't matter what you call it, for writing (ofstream), and then create another stream for reading (ifstream). Use the getline function on the input file stream ( while( std::getline(in, line) ) ), where line is a std::string), and keep a running total of which number you're at ( int line_num = 0; /* ... */ (inside the loop) line_num++ ), and if the line number matches the numbers you want to delete don't save the line to the output file. Else save it. If you want to delete the original file do so and perhaps rename the second file to what the first was called. Otherwise... you're done.

twomers 408 Posting Virtuoso

There's a lot of talk about drugs here of late (kinda). Did anyone ever play this game - http://www.geekhideout.com/druglord2.shtml It's pretty amusing!!

twomers 408 Posting Virtuoso

Surely they must have a reason though. "Government won't allow it" aint no reason.

twomers 408 Posting Virtuoso

Did she answer the question?

twomers 408 Posting Virtuoso

How'd DOS (or the lack there of), come into the discussion of the end of the world!?

twomers 408 Posting Virtuoso

I dunno. I'm normally all for sweeping generalisations, Fast, but ... everyone's against them. I feel sorry for them. (still voted for them on this pole though).

twomers 408 Posting Virtuoso

I've had a fair few dodgy cheap reds, Infarction. I've had one expensive red. Maybe I'm not learned enough in the whole industry.

twomers 408 Posting Virtuoso

cout << "Enter the grade for Exam 1: ";
cin >> 100
//...

I assume what you want is to have those as the inputs, right? That doesn't work. You can't read in a number like that. What you're going to have to do is read in a variable and when you run the program the variable is assigned the number you type in (see below).

>> int exam 1
You can't do that either. Variables cannot have spaces in their name. int exam_1 is more what you want. Or you can do what you did later on in your code and call them exam1, exam2 etc.

int grade_1;
cout<< "Enter grade for exam: ";
cin> >grade_1;

cout<< "You entered: " << grade_1;

The rest looks OK.

twomers 408 Posting Virtuoso

Take a look at this:

int main() {
  int numbers[4][4] = { { 0, 1, 2, 3 }, 
                        { 4, 5, 6, 7 }, 
                        { 0, 9, 8, 7 }, 
                        { 6, 5, 4, 3 } };
  int (*p)[4] = numbers;

  (*p)[0] = 42;
  p++;
  (*p)[3] = 63;

  for ( int y=0, x; y<4; y++ ) {
    for ( x=0; x<4; x++ )
      std::cout<< numbers[y][x] << " ";
    std::cout<< "\n";
  }

  return 0;
}
twomers 408 Posting Virtuoso

Heh.
I don't find it vile but I don't practise the habit either.

twomers 408 Posting Virtuoso

You're wrong, Dude. Red all the way!
I had an amazing one with an amazing steak a few months back. It was then that I discovered that the more you pay for wine the nicer it actually gets! I honestly never tasted the difference before. But red. I'm sure if I had a nice white it wouldn't offend my taste buds or anything... but if I had to buy some. Red.

twomers 408 Posting Virtuoso

Erm. Copy all relivant data?
By the looks of it start at the back pointer and iterate to the front pointer assigning the values at each of the nodes (from Q), to your object along the way.

twomers 408 Posting Virtuoso

Yeah.
I've always (not really), wanted to try vicodin since I started watching House. Not that I'm impressionable or anything...

twomers 408 Posting Virtuoso

Create a string containing all the letters you want to use. Seed and use rand() to access elements (using the % operator to force the numbers within the string's range). Strcat in a loop. Pseudo-code.

my_letters = "abcdefghijklmnopqrstuvwxyz" /* allowable letters for your random string */
my_random_string /* your random string. Initially empty */

srand( time(0) ) /* seed rand */

for i=0 to 10 /* or however long you want it */
  append( my_random_string,  /* append to this string */
          my_letters[rand()%strlen(my_random_string)] ) /* this letter */
end loop

Or something like that. Alternatively you could just rand() (limit up to 25) and add 'a' onto the number and append that to your string. I think the above method is better though because you can extend the characters you use (you could put numbers, symbols, capital letters in it). That is harder to do with the second method I mentioned.

twomers 408 Posting Virtuoso

>> a bottle of whisky..
Man after my own heart ;)

Wheetabix and tea.

twomers 408 Posting Virtuoso

Well. Regardless of the loop kind (assuming it's allowed to iterate enough times), it should read in the info:

while ( in >> word )
  std::cout<< word;

Where in is your input file stream and word is something used to store the information of the file.

twomers 408 Posting Virtuoso

And not even April! (it's DHMO's 'breeding' season)

twomers 408 Posting Virtuoso

You can point it to the first y position.

int *p = numbers[0];

Or whichever one you want.

twomers 408 Posting Virtuoso

Is Surry near Essex... What your thoughts on wrestling, Serunson?

twomers 408 Posting Virtuoso

I realised you inlinecode-ed it. I edited my last post.

twomers 408 Posting Virtuoso

Dude, I told you to use code tags!

One option would be to read the value to a temp string. Test that for "stop". If it is stop assign the new element that value. Else break. Then outside of the loop test that string for "stop" and do what you want then.

twomers 408 Posting Virtuoso

It's a 2-D array, presumably. Start from the top and go along each row and record the position of the first one.

Pseudo code:

loop y=0, 5
  loop x=0, 5
    if val of array[y][x] is 1
      print (x+1)
      break loop
  end loop x
end loop y
twomers 408 Posting Virtuoso

You've gotta get a girlfriend!