twomers 408 Posting Virtuoso

Basically all you have to do is set a counter. I assume you're reading the contents of your file in a loop, right? Before the loop do something like:

int counter = 10;
while ( FILE_READ_CONDITIONS && counter>0) {
  // etc
  counter--;
}

Or you could put a counter-- in the while conditions if you like.

twomers 408 Posting Virtuoso

>> There was a reason why rhetoric question was specifically written within parenthesis.
Same reason as void :D I got the joke, by the way.
I merely thought the quote correlated to the situation. Anyways, I don't think the OP's coming back. Been fun posting in this thread!

twomers 408 Posting Virtuoso

>> I have had all sorts of boyfriends
I still think you're a dude... probably because of the "drink her pretty".

>> girls like to be wooed, look (not stare) at them,
Boys like to stare though...

That's crazy, AD. Not crazy, I guess, but I'm 21 so by my age you'd've been married for two years!

twomers 408 Posting Virtuoso

>> How can something correct be corrected? ( Rhetoric question )
"Try again. Fail again. Fail better"

twomers 408 Posting Virtuoso

Thanks. I've 7 days left though :D

twomers 408 Posting Virtuoso

I dunno... The president should do more than act like a leader, but unfortunately the only way to determine their suitability is to put them in the chair. They should give each candidate a small state. Put them in charge for a while and see what happens.
But McCain is about a hundred.

twomers 408 Posting Virtuoso

Heh! There is no 'she'. Plus. I was mainly kidding.
I'm lovely in real life. Honest.

twomers 408 Posting Virtuoso

I have a reputation of dumping people before Val's day. So much so that my friends have a bet that I'll get a girlfriend before the 14th and dump her before the 14th. Not a serious one mind.

It's the most economic solution. Dinner. 'Present'. I might as well just give her my bank account.

twomers 408 Posting Virtuoso

So what you do is find a really hot girl and ask her out every Tuesday until she says yes. We'll call her Cameron ...

joshSCH commented: lol.. +12
twomers 408 Posting Virtuoso

I read none of the replies but I find it so bloody frustrating when I watch a game of football (soccer). The players get paid more than I have probably earned in my lifetime every week and yet they can't stay on their damned feet! Can't they just play the game and not the odds? Because of this I put it down very very low in my list of sports. To put it this way -- I've seen one half of a game of American Football and I preferred that.

>> and absolutely no strategy is involved at all.
I disagree.
There is strategy and skill... but also much idiotic play that makes my blood boil.

twomers 408 Posting Virtuoso

I watched the first half of the game last night. I actually enjoyed it quite a bit. I was set to watch it all until it was mentioned that there was a 45 minute break between halves.

I was going for the giants though -- they were the first team I saw so I thought why not.

twomers 408 Posting Virtuoso

In how close pool is to snooker, I think.

Rules here -- http://en.wikipedia.org/wiki/American_football_rules Long read

twomers 408 Posting Virtuoso

I did. I wanted Wales to win and Ireland to win so I was happy on Saturday. France I always want to loose, unless they're playing England, so I was disappointed there. Ah well. I reckon France this year.

twomers 408 Posting Virtuoso

Nah. It's on BBC2 though. It'll be starting in about a half hour or something.

twomers 408 Posting Virtuoso

Or in C++, why bother with what one may call 'messy' character arrays, when there is a 'nice' string type at our disposal. Look at the .substr() method of strings. I recommend looking at the first word of the sentence, finding the next instance of that letter, checking for equality with sub strings from the first letter to the second instance of the same and the substring from the second instance plus the distance from the first to the second, etc. Know what I mean? If that fails try for the next instance of the first letter until you pass the mid-way point of the string. Then go to the second letter ... sounds like fun, huh?

twomers 408 Posting Virtuoso

>> It's not a big deal for me.
But surely if it wasn't a big deal for you, Joe, would you even do anything?
Yet, I say this when I envision you being near the north of Canada in an igloo of some description... so you'd probably ski to work, so normal day at the office I suppose.

twomers 408 Posting Virtuoso

I reckon I'll watch some of it anyways. Turns out it's on two channels I have. Wasn't certain I could watch it before now. Who should I support? (First team mentioned wins)

twomers 408 Posting Virtuoso

Well, if you use vec.size() surely the vector is empty when you're trying to null everything... right? Also, doesn't transform take four parameters?

Anyway, something like this should work:

#include <iostream>
#include <vector>
#include <algorithm>

#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>

template <class ty>
  class nullify {
  private:
  public:
    ty operator ( ) ( ty &elem ) {
      elem.reset();
      return elem;
    }
  };

int main() {
  // List of pointers
  typedef boost::shared_ptr<int> TSmart;

  std::vector<TSmart> Vec;

  // Make sure that everything is NULL
  std::transform( 
    Vec.begin(), 
    Vec.end(), 
    Vec.begin(), 
    nullify<TSmart>() );

  return 0;
}
twomers 408 Posting Virtuoso

Grumpy as in Scrooge?

twomers 408 Posting Virtuoso

... Fair enough.

twomers 408 Posting Virtuoso

twomers is a play on my surname (or second name if that's what ye say).

>> would love to your story!
Me too.

joshSCH commented: 'ye'! hehe +12
twomers 408 Posting Virtuoso

It depends on what help you seek. Search for a likely forum here -- www.daniweb.com/forums

twomers 408 Posting Virtuoso

Same here... "It's time enough women humbled themselves and take their rightful places in our kitchens wearing aprons!" That's a tad sexist especially when you talk about racism and special treatment. Makes your post seem quite empty.

twomers 408 Posting Virtuoso

I normally don't do it, but here's a solution:

#include <stdio.h>

int main() {
  printf("1 5 7 11 13 17 19 23 25 29 31 35 37 41 43 47 49 53 55 59 61 65 67 71 73 77 79 83 85 89 91 95 97 ");
  return 0;
}
twomers 408 Posting Virtuoso

Heh. Gotta agree with ya there! Great come back. I'd lost faith in Wales after the first half only to come back into the room to see them score their winning try!

twomers 408 Posting Virtuoso

Guys don't nag... they instruct... kidding :D

twomers 408 Posting Virtuoso

Edit: post double posted. Could an obliging moderator delete this one please?

twomers 408 Posting Virtuoso

No idea about pause, but the warning is solved by putting a return 0; before the closing } in main:

int main() {
  // Your code

  return 0;
}
twomers 408 Posting Virtuoso

Non portable means that the code won't work on all systems -- suppose you were to compile on one system it might work but that doesn't mean it will compile on all systems. Using system is a bad idea for pausing. getch() is a lazy excuse. Duoas' solution is good. Use that.

twomers 408 Posting Virtuoso

It looks like VB, but I en't sure.

twomers 408 Posting Virtuoso

Why are Google evil?

twomers 408 Posting Virtuoso

All proper Irishmen support Glasgow Celtic ;)

twomers 408 Posting Virtuoso

The problem is (not really a problem), that the program is running too fast and doesn't have anything to stop it from closing. There are a number of options to solve this, most of them are mentioned here -- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1043803465&id=1043284385 so if you're using C++ throw a cin.ignore(); and cin.get(); before you return 0; at the end of your program

twomers 408 Posting Virtuoso

Not decided. I've never watched it so maybe I should... on the other hand I don't know what time it's going to be on Irish time.

twomers 408 Posting Virtuoso

We can't help without seeing the offending code.

twomers 408 Posting Virtuoso

I reckon I must be easily irked... but when people call you 'the baby' because you're the youngest of the family and then smile cause they think they're being funny.

twomers 408 Posting Virtuoso

>> really lucky man...
To have survived this long? Yeah! I agree.

twomers 408 Posting Virtuoso

Not in this case, but it would also make an amusing video should the thing melt and burning fuel flows under a car... am I wrong?

twomers 408 Posting Virtuoso

Well, as nice as command != ('A' || 'B') looks it doesn't work like that. if( command != 'A' || command != 'B' ) is what you're looking for, but to be honest a straight out else should do -- it's proven to neither be an 'A' or 'B'.

Not sure if that's your problem now. Don't have linux.

twomers 408 Posting Virtuoso

You use code tags: [code] PUT YOUR C CODE HERE [/code] for future reference.

The code I posted was meant as a learning exercise. It wasn't meant to do anything other than to show you how to access arrays.

For the random number:

for (counter = [B]0[/B];counter <= 2;counter++){
    value = rand()%1;
    printf( "%d", value );
  }
twomers 408 Posting Virtuoso

I recommend you download a proper C compiler for yourself at home... there should be a list somewhere... http://www.cprogramming.com/compilers.html There's no point in stoning away when you should be in the slick 21st century.

Anyway.

There aren't many things about arrays, fortunately.

int main( void ) {
  int int_array[2][3] = {0};
  int_array[0][0] = 12;
  int_array[1][1] = 12;

  int y, x;

  for ( y=0; y<2; y++ ) {
    for ( x=0; x<3; x++ ) {
      printf( "[%d,%d] - %d\t", x, y, int_array[y][x] );
      int_array[x][y] = x*y;
    }
    printf("\n");
  }

  for ( y=0; y<2; y++ ) {
    for ( x=0; x<3; x++ ) {
      printf( "[%d,%d] - %d\t", x, y, int_array[y][x] );
    }
    printf("\n");
  }

}

You assign and get values by accessing like so. That answer your question?

twomers 408 Posting Virtuoso

Ew!
A few things.
* <iostream.h> and <fstream.h> are old and now in the form of <iostream> and <fstream>. You might want to using namespace std; if you're going to change them.
* main returns int, so int main().
* Why are you using C File IO when this is C++? Or rather selectively using it? Pick one method and stick with it, OK? There's no need to confuse yourself with more than that.
* matrix[101][3] has 101 (0 -> 100), columns and 4 rows (0 ->3).
* Use code tags.
* There are easier ways to generate random numbers. rand()%1, rand()&1 are just two[1]

Now. To your code...

[1] For fuller reasonings read about random numbers

twomers 408 Posting Virtuoso

>> House isn't a sitcom.
Tru dat. Saw sitcom, thought TV and said House. 'Pollogies to my peers.

twomers 408 Posting Virtuoso

(In respect to myself) not see what's blatant!

twomers 408 Posting Virtuoso

House.

twomers 408 Posting Virtuoso

As in sales[20] and p[20]? It's just the size of the respective arrays. They can hold twenty elements. p is uninitialised but sales is by virtue of ={numbers];.

twomers 408 Posting Virtuoso

>> Could anybody help me with the code please?
Not unless you show some work.
But it's not that hard. There are two problems to overcome -- 1) filling the array 2) reading values from a file. Once you have those two done there's really no problem. Show attempts on both.

twomers 408 Posting Virtuoso

I dunno gravy...

If you had a grain of titanium, perhaps. But a grain of, say, warm sponge cake... nah. That's not even going to puncture a fast traveling waterfall of warm chocolate sauce.

Sure we all know we're going to make use of worm holes anyway and learn to bend and warp them to our needs, thereby bending the space-time continium and going from A to B quite slowly but in little time.

twomers 408 Posting Virtuoso

Was that barrel plastic?

Either way:
[Napoleon Dynamite]Idiot![/Napoleon Dynamite]

twomers 408 Posting Virtuoso

>> Can anyone tell, how can i write that program in C++
Write some C++ code that does the job.

A small starter point:

class shape{
protected:

public:

};

class triangle : public shape {
private:

public:

};

class square: public shape {
private:

public:

};

class circle: public shape {
private:

public:

};

int main() {
  return 0;
}

Work from there.