Coincidence : today C++ ?

in #programming4 years ago (edited)

Since 2021 i have the habit of doing 1-in-20 to keep my brain warm at night - a few of those is stuff i havent done before and one of those is C++

as it so happens today its C++ (fate decides so maybe my first supreme project is a program that tells me what to do tonight)

(until i have your sisters panties back ofcourse ...)

Being supernew to this i start at :

https://www.w3schools.com/cpp/cpp_intro.asp

but with their example

#include <iostream>
using namespace std;

int main(){
    
    cout << "Hello World";
    return 0;
}

i find myself in dire straits right away :

rendercat@Thirdspace:/media/rendercat/nanovault/dumpster/dirzof leeber/cpp$ gcc ./1stone.cpp
/usr/bin/ld: /tmp/ccXfPV6C.o: in function main': 1stone.cpp:(.text+0x12): undefined reference tostd::cout'
/usr/bin/ld: 1stone.cpp:(.text+0x17): undefined reference to std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' /usr/bin/ld: /tmp/ccXfPV6C.o: in function__static_initialization_and_destruction_0(int, int)':
1stone.cpp:(.text+0x4b): undefined reference to std::ios_base::Init::Init()' /usr/bin/ld: 1stone.cpp:(.text+0x60): undefined reference tostd::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status

So as it turns out gcc is the compiler for c , not for C++

and thus it came to pass that :

*rendercat@Thirdspace:/media/rendercat/nanovault/dumpster/dirzof leeber/cpp$ g++ ./1stone.cpp rendercat@Thirdspace:/media/rendercat/nanovault/dumpster/dirzof leeber/cpp$ ./a.out Hello Worldrendercat@Thirdspace:/media/rendercat/nanovault/dumpster/dirzof leeber/cpp$*

you might think huh ? its one small step but these little details are often quite discouraging for people to pick it up and despite all the goodwill the linux community tends to be often so geeky they forget that to most people "what YOU do daily" doesnt come "de soi" en francais

...

this should get me started, i have no intention of suddenly flooding the block with posts but since its a bit closer to worth something i might follow up as i learn a little on either nasm or c++ on days where fate decides its them today (why not ...)

atm all i know is that cout << "hello world" looks a hella lot like linux shell scripting (so i can read that) ... , #include is used in php (close syntax but in practice its done with require() or require_once() there although i think SSI is still possible im not sure , i think combell removed it for some reason at some time (just like they totally abandoned perl a year or two after i got some notions of that lol) so that is a standard "pre-fab" library being included there (meaning if you saw the whole program it would be like HUGE before compilation)

no idea what "using namespace std" is for (but i'll find out)

the int main(){
}

i suppose is just how c works being a function that's defined as an integer result and hence the "return 0" at the end

other than that , im C++-blind as a newborn kitten

Screenshot from 2021-02-15 04-42-33.png

i use #geany for the longer stuff usually , but im quite happy just using Xed (the linux mint notepad) for most, none of that fancy stuff needed

i feel the further things go, the further it gets away from the machine and you end up with generations who can do your wife-in-five but have no idea on how the machine works

so i hope #c++ and #nasm will tell me things ...

things i forgotten - things i should know - the flow of things (which hasnt changed since johnnyboy "da playboy" von neumann came up with it much)

"the wicked have told me of things that delight them"
"but not such things as your law has to tell"
(Saint Augustine, "the pope of debauchery") (=lol)

bem if i keep typing here i wont be typing much there

actually yes : geany is awesome but if you need to check binary files, especially large ones i would say #sublime would be your friend , it does the trick for my binary files like worldmaps sent from the server to the client in +10 or +20 kb files (thats a lot of bytes , thats an even lotter lot of bits, depending how you use it that's a lot of states a place can have)

stay tuned for more (or not :) ) ) ) )

yagh - same here if it keeps up i'll make sure vp is at 60 or 100 at least but most vp should come from the game (as intended)

and see lo and behold, im already learning #stuff :

https://www.educative.io/edpresso/what-is-the-difference-between-endl-and-n-in-cpp

w3schools goes like "you can use either \n or << endl" and me like "BUT !"

and ofcourse theres a difference (i dont know why but im probably just that ancient that things like "performance" pop up before "how to force users to write code in a way you think is right", in the age of "add another terabyte"

the rule of thumb EXPLAINED instead of saying "/n is preferred" thus forth cometh down to :

don't use <<endl unless specifically needed since you have extra ops on every cycle of a loop (for one thing)

where an "OP" would be one single instruction at machine level because

all the goodwill in the world : your computer does not speak python and does not have objects, it has OPs ...

gud - learned SOMEthing - thats gud ... now just wait for that steem to rise to 46.000 and by then by the next fly by i'll try to make a structured post when "today is C" comes up

u wut ?

i think it IS important in the age of supercomputing - maybe even more so now since if you loop x billion ops per picosecond (...) and you use one op extra in each loop it takes like double time ...

so

#include <iostream>
using namespace std;

int main(){

    for (char i='A'; i <= 'Z'; i++)
    {
    
        cout << i << "\n";
    }
    return 0;
}

is preferred over

#include <iostream>
using namespace std;

int main(){

    for (char i='A'; i <= 'Z'; i++)
    {
    
        cout << i << endl;
    }
    return 0;
}

since you get one extra flush/op (maybe thats even more than one i wouldnt know atm ...) EVERY cycle of the loop

(assuming loops are not martian language to thee - - ... if it is its probably better to pick up basic or simply flowcharting ... theres a witness justyy who seems quite dedicated to the job here somewhere)

also : looping characters by incrementing them i dont think ive seen that in anything ive done yet ...

and THAT guy works for ... o wait no , its the python guy who got lured by Crotter inc. ... the C++ guy works for some massive bank i think (not sure but i think) and is probably presiding several pantheons in other places

i SO need a tosti ...


yagh .. that hit the spot and ?

yea old debates ... i see no point there, but i DO see a point in voting for witness from multiple accounts - i used to try and make proposals "back in the day" but since im not l33t and i dont speak the promqueen-speak and im a bum who doesnt even have a hi school degree (hahahah NOW whos lol ?) i dont matter and i actually should know better at my age than to think the world has changed

see : if i have 100.000 SP and i use it from one account or divide it over ten then the effects on the chain are just the same (in case you know anything about it other than the magic-words-that-sell)
IN FACT : (piece de résistance) spreading it over multiple probably drains the pool less (well that was at the moment of "the-hardfork-that-killed-the-little-people") since of the curve not being linear anymore but you get more the more you have (instated by the elder elders from before against all opposition from the plebs who put them there ..) so you would get less curation on a 100 sp account than you get on a 10.000 sp account (percentage wise, you would ofcourse get less in numbers too by default) HENCE !

a blockchain with a cryptoken as coin has wallets for accounts THATS NOT THE ISSUE

a blockchain that uses a witness system for governance (and still calls that de-centralized since 25 or 50 people decide - which is like 10% of the governments here or less so that means belgium is more de-centralized than steemit ... ahem ... no comment ... like i said : old debate been there done that, bought all t-shirts in the walk-in closet ... its no use : the rich will do what they can to get more and thats that)

i have no idea if things have changed in the later patches BUT

my point (im great at "just-yes-or-no" im the absolute champ in that and i speak in brackets in brackets so by the time my original sentence gets a period or exclamation mark i have had 1 to xteen sub-routines who have or have not finished themselves in the middle ... its just how the brain goes if you're janes underground

the point :

i only vote for witnesses from one account SINCE

to keep that system fair you should only HAVE one witness vote per actual physical user

im all up for registered accounts btw BUT CAVEAT :

not for "one-account-per-person" but "one-account-that-can-vote-witness-per person"

as for the rest - its supposed to be defy (de-fi ahem) and decentralized so wallets for all!!
(as explained in the "100.000 sp is 100.000 sp even if divided by 10 times 10) section

so

instead of getting further in c

i got here

this is a fairly quiet night - - - i think most of them are sleeping (i dont hear voices - its NOT like that :)

but im clearly damaged goods - even if some think a carrot on a stick will lure Jane out

you cant have Jane without the underground , to do so you have to cut off a piece and then you're left with dead flesh rotting ... its why i come over a stitched together zombie with 50 jekylls to my 20 hides

yea, i speak in biblical and car- metafors a lot it seems to help

:)

call me an autist if you like

im not but its easier

this would be censored mostly irrelevant but the harem girfriends dont venture this deep

once someone got into my head
they never found the way out again

lasciate ... voi che entrata

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63493.34
ETH 2578.53
USDT 1.00
SBD 2.79