twomers 408 Posting Virtuoso

But he has wings, Naure. Wings!

twomers 408 Posting Virtuoso

Sorry! My bad:

for (k =0; k < rows; k++) {
      for (m =0; m < cols; m++)
        cout<< image[k][m];
  cout<< "\n";
}

What I posted earlier just throws everything on one line but this should put a new like after every row. stupid mistake of mine. Sorry.

twomers 408 Posting Virtuoso

>> It's the remote processing that gets a little tricky.
Don't listen to her! She doesn't believe in you. I know you can do it!

twomers 408 Posting Virtuoso
class vhand{ ... };

Come on, dragon. Surely you can manage that!!

twomers 408 Posting Virtuoso
for (k =0; k < rows; k++)
      for (m =0; m < cols; m++)
        cout<< image[k][m];
twomers 408 Posting Virtuoso

>> American energy policy regarding nuclear energy seems to have been shaped more by the movie 'The China Syndrome' than by anything available in the facts themselves.

Not so. http://en.wikipedia.org/wiki/Three_Mile_Island Three mile island was a near nuclear disaster in the late 70's. The danger is very real but complete isolation from new and developing plants was stupid too. Safety has been increased dramatically by standard since then.

>> the really nasty stuff is never supposed to leave the reactor.
See uranium 238 is what is mined commonly, but that's now what we use in the reactions. We want another isotope - U235. The half life is measured in millenia (with 238), but in the reactor the process is speeded mega-fold up by firing neutrons at the atoms which slpit up and create a chain reaction locally within the core (which is controllable), which releases power. Some stuff might be left in the core, but as I stated earlier, after about a year and a half most of the 'good stuff', has already been utilised, so what's left is useless.

twomers 408 Posting Virtuoso

>> How else would sum up the total of the number the user entered?

#include <iostream>
#include <iterator>
#include <numeric>

int main()
{
   std::cout << std::accumulate(std::istream_iterator<int>(std::cin),
                                std::istream_iterator<int>(),
                                0);
   return 0;
}

Only kidding :) Ignore that!!

Now.
>> for (num=1; maxNum=1; input++)
Do you know the proper format for a for loop?
for ( INIT; CONDITION; OPERATION )
so you want for num=0; num<maxNum; num++ )

Also, a good habit to get into is to initialise your variables to a certain value. So:

int num = 0;
int total = 0;

as they are not guranteed to be defaulted to one. If you look at the variabel total it's not set to any value so if you add something to it... the sum may not be correct.

>> maxNum++;
Why did you do that?

twomers 408 Posting Virtuoso

>> int image [ROW_SIZE][COL_SIZE];
OK. You want to display the image as characters ... do you need to keep it in memory? If you do you can either change the type of the image to a character array. It'll read in all the numbers as single characters. Then, once it's all read in, you can convert a '0' to a '-' or whatever, hece using the same variable.
Alternatively you could just create a second array of the same size...

It might be worth dynamically allocating enough memory for the image at runtime ... You familiar with new/delete?

twomers 408 Posting Virtuoso

You used 'zealous' in your introduction. We're off to a good start!

twomers 408 Posting Virtuoso

A funny thing is that Ireland's government is against nuclear energy being produced in Ireland, but it doesn't mind importing it in (there's a proposed link from the UK to Ireland where power will be bought and some of that's bound to come from nuclear!).

twomers 408 Posting Virtuoso

>> The 15 tons of uranium you are talking about must be highly enriched uranium.
3% The particular isotope that we use for the more general purposes naturally occurs at 1% (but processes called fast-breeding reactors use pretty much the whole lot!), but it is enriched to 3% and then used.

>> The world's supply of this particualr isotope of uranium is very limited, as far as I read.
With current processes the current known sores of it should last about 150-200 years (a lot longer than oil), but if fast breeder reactors are used more the life span should increase by at least ten-fold.
Also, remember uranium is mined. So it's not as though we can't get more :) Plus about 2-5% (I can't remember the exact figure), of the waste can be processed again to extract more useful uranium and this process makes it less 'bad'.

>> wind, solar, and wave energy
Wind is good, very clean etc, but it is not reliable. It's power is as a function of the wind ... same with solar with the sun. Sure you have predominantly sunny and windy places which integrally have a steady theoretical generation rating but that doesn't mean that every day you're guaranteed to get the power you want! Some good days, some bad days. Wave is like (kinda), hydro. Well it depends on the setup really, but they can be modelled with very similar methods and equations.

>> I …

twomers 408 Posting Virtuoso

>> Also, some of the highly radioactive waste is in the form of inert gases. Very difficult to contain for thousands of years!

Well not so. You are right, of course, about the gasses, but they are confineable.
In nuclear power generation the core is sealed off from the outside completely and that's where the radioactive 'stuff' is put and made react. That stays in there for about a year and a half (depending on the process it could be more or less, but 18 months is generally a good marker), so it is only when someone is to replace the fuel that the outside is exposed to the inside of the core. However someone'd be pretty stupid just to open my hypothetical door and let it all out. There are precautionary measures after precautionary measures being taken to ensure the gasses do not leak. I believe the chamber is vacuumated, flushed again and again, all bad gasses and waste is collected and then kept under heavy water for 40 years (no exaggeration there, honest!), and then burried. The danger of it (lets not ignore it is dangerous), leads to extreme precautions.

twomers 408 Posting Virtuoso

>> That only leads to ugly looking and dangerous high tension transmission lines all over!
Nope. That's just power :)
Power density is the amount of utilisable power in a substance per unit mole of it. So the more power you can get from something the less you need. Uranium and plutonium (which can be used too), have astronomical power available (ideally 3*10^6 times that of coal, but in reality it's reduced to about 120-140 thousant times due to impurities and power losses in energy conversion).
It's like technology - the smaller it is the happier we are! We no longer need room-sized computers, for example. So why need 130,000 times the stuff to get the same?

twomers 408 Posting Virtuoso

The source file itself got deleted? I'm disinclined to believe it could be the compiler ... but what compiler are you using? You certain it's gone? And that it's just not where you thought it should be. Have you searched for it? (as in the OS searches, not you)

twomers 408 Posting Virtuoso

>> Most of us are on a diet, but you need to drink and eat something?
Really? Well I'm not actually on a diet. But I was amused for a moment by someone who might be on a diet drinking heavy-water instead of the normal stuff.

twomers 408 Posting Virtuoso

Also the enviornmental impact of some clean energies (I'm thinking hydro), has spectacular enviornmental inpacts. Take for example the three gorges dam. 1.2 million people were relocated for that. Think of the Hoover dam. Sure it's in a desert but before and after photos show the extent of it.

twomers 408 Posting Virtuoso

Sure there are but the alternatives are in no way as power dense as nuclear. You say it pollutes the earth for thousands of years, and to some degree you are right. But consider this:

Suppose you want a 1 GW power plant. If you're using conventional steam powered stations you're going to require about 3 million tonnes of coal (about 2.1 or so of oil), to generate this power and with that tonnes and tonnes of waste is put into the atmosphere (nasty ozone depleting and global warming stuff like sulphuf dioxide, carbon dioxide, thier monoxides etc).

With nuclear you need 15 tonnes of uranium (or less depending on which process you use), and 1 tonn of waste is outputted. Now the generation of this energy doesn't produce any of the nasty pollution that oil burning does. None of it. It's 'clean'. But what it does produce (while dangerously toxic), is easily confineable and while we can't destroy it we can bury it deep deep into the earth surrounded by layers of concrete and lead and steel which makes it ... for the sake of the arguement ... clean.

I know you mentioned clean energies but the thing is nuclear is cleaner than a lot of methods and all clean energy production (so lets compare like with like), but it does not approach the necessary power densities that are required for the population demands of now, and the future. Unfortunately only fossel fuels and nuclear do that.

twomers 408 Posting Virtuoso

Nah. I'm on a diet.

twomers 408 Posting Virtuoso

Wasn't planning to, but thanks for the advice.

twomers 408 Posting Virtuoso

http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_bst1.aspx is a good reference. It's in C but it describes all the concepts very well.

twomers 408 Posting Virtuoso

Hahaha. I like it, Dave.

Oddly enough I got an email today from 'Paypal', asking me to 'Verify my account' with them... However I have never used their service so, obviously I didn't reply or do anything with it. Anyone ever have this happen to them. I wonder if this thread told some phishers/spammers that I have a credit card ...

twomers 408 Posting Virtuoso

Hi all.

In university we're studying different types of power systems and generation methods and one of the more interesting types are nuclear stations.
I know where I stand on it but I'm curious as to what others think.

For, or against? Please specify why.

twomers 408 Posting Virtuoso

I wanna try heavy water sometime.

Tea, again, and a burger.

twomers 408 Posting Virtuoso

Can you give us a sample main() to illustrate the problem clearly?

twomers 408 Posting Virtuoso

Yeah... I can see that effecting the earth more than fempto powered fields.

twomers 408 Posting Virtuoso

Nah. I understood you, J. Us smart people must stick together, right.

twomers 408 Posting Virtuoso

Yes.
Do it for the kids.

twomers 408 Posting Virtuoso

It's an open day for the university of Portsmouth... where they presumably show off everything they have.

twomers 408 Posting Virtuoso
void Student::input ( )
{
    cout << "This program reads a student name and the number and name of the classes.\n" ;

    cout << "Enter the student name:  " << flush ;
    getline ( cin , name , '\n' ) ;

    cout << "Enter the number of classes:  " << flush ;
    cin >> numClass ;

    delete []classList;
    classList = new string[numClass];
    cin.ignore();
 
    cout << "Enter " << numClass << " classes, each followed by pressing 'Enter':\n" ;
    for ( int i = 0 ; i < numClass ; i++ )
        getline( cin , classList [ i ] ) ;
}

I highlighted the changes in red. You have to delete what's there and re-allocate it so that you don't mess it up! And the ignore goes after the >> but before the getline()

This program reads a student name and the number and name of the classes
Enter the student name: 5
Enter the number of classes: 5
Enter 5 classes, each followed by pressing 'Enter':
d
d
d
d
d
Outputting student data for: 5
1. d
2. d
3. d
4. d
5. d
Outputting student data for: Caleb
1. Cisco
2. C++
3. Economics
4. NV.NET
5. C#

Duki commented: Excellent help. +4
twomers 408 Posting Virtuoso

Your other problem use cin.ignore();

Mixing up getline() and cin>> and getline() again will store '\n''s in the the buffer which getline() will recognise and hence pass out.

twomers 408 Posting Virtuoso

Also you can put the initialisation in the initialisation list:

Student::Student ( string sName , int numC , string cList[ ] ) : name ( sName ) , numClass ( numC ), classList( new string [numClass] )
{
    for ( int i = 0 ; i < numClass ; i++ )
        classList[ i ] = cList[ i ] ;
}

Might as well use it when you can.

twomers 408 Posting Virtuoso
Student::Student ( string sName , int numC , string cList[ ] ) : name ( sName ) , numClass ( numC )
{
    classList = new string [numClass ] ;
    for ( int i = 0 ; i < numClass ; i++ )
        classList[ i ] = cList[ i ] ;
}

You must specify the size of the array you're allocating. Can'e new[]!

twomers 408 Posting Virtuoso

>> Some astronomers say that it might trigger a shift of the earth's magnetic poles,

OK. Fields decay with 1/r^2 ... so ... 1/light-squared-years is very very small.

twomers 408 Posting Virtuoso

What won't work? People mightn't compile your code so you're going to have to give us some more info.

Errors, warnings, crashing?

twomers 408 Posting Virtuoso

String is part of the standard library so either:

using std::string ;

or std:: all strings.

twomers 408 Posting Virtuoso

More apples and apple-related cakes. Tea.

twomers 408 Posting Virtuoso

I've heard it's meant to be very like 'eraser', which I didn't like so I haven't gotten it as of yet.

twomers 408 Posting Virtuoso

Meh. You don't have to be not-stupid to keep yourself out of debt.

twomers 408 Posting Virtuoso

Heh.
Two stolen doughnuts and thirty years later you're gonna thank me :)

twomers 408 Posting Virtuoso

I just have the one which I got a few months ago. I don't really use it much and I guess it's there just incase I need it ... and cocaine of course. How else can I break it up?

twomers 408 Posting Virtuoso

>> Hahehe, leave it to an Irishman to suggest whiskey!
Next time you have a cold/flu try that!

twomers 408 Posting Virtuoso

You're going to need: Lemsip, paracetamol, whiskey, cloves, hot water and lemons.
Being sick of programming is like being sick regularily, right?

twomers 408 Posting Virtuoso

The Google Story is interesting, but that said I only read up to the pictures half way through because I had to read it for 'innovative invention' for a subject in uni.

twomers 408 Posting Virtuoso

Heh. You come by this gem with experience?

twomers 408 Posting Virtuoso

>> Not even the guy who started the website.

Arent ye (by which I mean Americans), required to put a 'return to' address on your mail? Or has TV lied to me again?

twomers 408 Posting Virtuoso

I think it's amusing and interesting to read the 'secrets', but one must always remind themselves that they might not be true ....

(sorry, just offtopic once more: iamthewee your PM thing is full... apparently)

twomers 408 Posting Virtuoso

>> is there a better way to do it?

Run this:

#include <string>
#include <iostream>
#include <fstream>

using namespace std;

int main( )  {
  string line, word;
  ifstream in;


// ONE WAY OF READINF FROM A FILE
  in.open( "FILENAME.TXT" );

  if ( in ) // If stream opened successfully
    while ( std::getline( in, line ) )
      cout<< line << "\n";
  in.close();


// OTHER WAY OF READING FROM FILE
  in.open( "FILENAME.TXT" );

  if ( in )
    while ( in >> word )
      cout<< word << " ";
  in.close();

  return 0;

}

And see if you can understand it. THe first way reads a file line by line and the other way does it word by word.

twomers 408 Posting Virtuoso

It's the latter, I think. Look at vectors later on. In short they're expandable arrays which aren't set in size on build.

He wants to store the whole file, I believe.

You know where you fin.open and fout.open. Only deal with one aspect of the proess at a time. First open the file and store the contents. Then close it and open the out file and write the contents you have stored by reading from the first file. Then close the output file.

So change:

ifstream fin;
        ofstream fout;
        fout.open(File);
        fin.open(File);
        while (!fin.eof()){
            fin.getline(line[counter], 125);
            counter++;
        }
        for(counter=0; counter<10; counter++){        
            cout<<line[counter]<<endl;
        }
        fin.close();

to

ifstream fin;
                // READ THE INPUT FILE
                fin.close()


        fout.open(File);
                // WRITE THE OUTPUT FILE
        fout.close();
twomers 408 Posting Virtuoso

OK. First thing first. You're using C++ so you should think about using std::string rather than statically sized character arrays. Benefits - dynamically resized, memory automatically managed, public methods, easy to use operators (like equality). Downsides - you're going to have to learn them.
Especially since you "#include <string>".

Also if you're going by words you might as well do something like:

// Prep work like setting up input stream, testing it etc.
std::string str;
while( in >> str ) {
  std::cout<< "This is a word: " << str << "\n";
  // etc...
}

Note or warning - that stops at whitespace. Not at punctuation so you're going to have to think about that.

I don't think you're going to be able to open a stream to both write and read a file at the same time. Open a stream. Read the contents. Close the stream. Open another one. Output the contents. Close that stream then.

Something else to consider is using a vector to store all the stuff you read rather than a 2D array.

twomers 408 Posting Virtuoso

Do you have a memory stick of some kind? Could you download it in an internet cafe or something and transfer it to your computer at home? Or, as you suggested, a friend? College? Work? School?