Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: There's Only One Way To Do It

by kutsu (Priest)
on Apr 07, 2004 at 14:22 UTC ( [id://343286]=note: print w/replies, xml ) Need Help??


in reply to There's Only One Way To Do It

This is not only true of perl and Java. In my C++ class I learned many, easily 20+ lines of code, difficult ways to create unlimited arrays. Once I looked at the standard headers included with C++, this was 4 years ago, I noticed vector.

#include <vector> #include <iostream> std::vector<char> array; char c = 0; while(c != 'X' || c != 'x') { //enter something or exit to quit std::cin>>c; array.push_back(c); //remind you of anything ;) } std::cout<<array.size()<<std::endl; /* btw., the way I learned to get an arrays length was to create a sec +ond int array as a counter*/

As for why the One Way, or more approapriately Best Way is ignored, that's a good question

"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://343286]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-03-29 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found