The Last Bloop Thread-Ecko

Discussion in 'Random / Offtopic' started by Great Sage Equal of Heaven, May 5, 2007.

Thread Status:
Not open for further replies.
  1. reno

    reno Well-Known Member

    immmm hungryyy ><
    its 1:30pm and hafn't had lunch =(

    o_O coding seems fun
    how abt i do it in perl? =P hahahaha

    i haven't done c++ for long time (not like i really did it to begin with ahahha, mainly use other stuff than c++)

    mmm perl
    something like

    file = $ARGV[0];
    file = open(inFile, "<$file");
    while ($line = <inFile>) {
    @strings = split(/\s+/,$line);
    foreach $string (@strings) {
    if ($string =~ m/\@/) {
    print "$string\n";
    }
    }
    }



    well fearless i'm not too sure of the data file u got
    cos u could have soemthing like (which is what i assume)

    aaaaaaa bbbbbbbbb somename@somewhere cccccccdddddd anothername@here
    eeeeee ffffffff gggggggggggg llalaalla@laallala

    which is the logic behind, take each line, split by spaces
    if that string contains @, print it =)
    can't remember which method gives the fastest time
    charindex? dunno =/
    but then if the data is like

    aaaaaaa,bbbbbbbb,somename@somewhere,cccccc

    then just split according to commas or wateva?
    haf fun! =)
     
  2. fearless_fx

    fearless_fx Eugooglizer

    wtf,

    people giving me python and pearl.. i need C++ lol
     
  3. reno

    reno Well-Known Member

    its PERL not PEARL -dead

    well i gave u the logic/psuedo code behind it
    i don't remember c++, so all u need to do is port the code over
    not too hard is it?
     
  4. fearless_fx

    fearless_fx Eugooglizer

    lol but i dont understand that code at all, its just a bunch of gibberish to me :p

    its alright though, im probably just gonna leave it, its only worth like 1% and its already 2 AM
     
  5. reno

    reno Well-Known Member

    hahaah
    alrite if u can b bothered

    do something among the lines of:
    (pseudo english code)

    open file
    read line
    foreach line
    - split the line into "strings", ie split it either by spaces, or commas or however the data is stored
    - foreach string
    - - if the string contains an "@", print it to some output (whether that be file or standard output, up to u, or however ur assn says)

    done
     
  6. fearless_fx

    fearless_fx Eugooglizer

    lol i understand the basic algorithm, i can also find the @ symbols within my input file without difficulty, its just getting the strings containing the @ symbols out of the file... i dont know the code for that. but oh wellzz
     
  7. reno

    reno Well-Known Member

    guess there isn't a built-in split function
    just google one up (if u got time) and use it

    u just need function to split the line into "words/strings"
    cos then with each word or string, u just test whether it contains @
    if that returns yes/true then u've got ur string! =)

    do it in C next time, not C++ =P
    then i can help! ahahah
     
  8. Flames

    Flames Out of Date User

    5,149
    432
    25
    You should be grateful that no one chucked a 80 line code of java or something lol
     
  9. reno

    reno Well-Known Member

    java it is next time =P
    lol

    or maybe just give him shell scripts =D
    heeheheh
     
  10. MissCheekS

    MissCheekS Reconnaîssant ❤

    addict? hehehe -sweat

    Lol....i woke up...-sleep


    have to walk sooooooo far to go to the damned toilet cuz of this stupid &%*@ renovation in our bathroom...
    its taking too long...have to walk allll da way downstairs everytime i need to go crapppp....-_-2
     
  11. reno

    reno Well-Known Member

    but exercise is good for u angie :p

    else u can always just slide down the handrail~ -bigclap
     
  12. Knoctur_nal

    Knoctur_nal |Force 10 from Navarone|

    16,563
    662
    29
    thas what i was thinking too..ha
     
  13. fearless_fx

    fearless_fx Eugooglizer

    anyway, i figured out the code i needed lol

    #include <iostream> // Declare iostream
    #include <string> // declare string
    #include <fstream> // Declare fstream
    using namespace std;
    ifstream inData; // Declare input file
    ofstream outData; // declare output file

    int main()
    {
    inData.open("mail.dat"); // Open files
    outData.open("addresses.dat");
    string email; // Declare strings
    string At = "@";
    while (inData) // Start loop
    {
    inData >> email;
    if (email.find(At)!=string::npos) // Check for @ sign
    outData << email << endl; // Print w/ @ sign only
    }
    return 0;
    }

    it was just that simple string::npos i couldnt figure out at first.
     
  14. ^ lol.. thats so much more confusing and longer than python lol

    speaking of programming, we should have a programming section/thread/w.e... im sure we got lots of programmers in this forum lol



    off topic, you know whats crazy.. the ipod touch is python capable o_O


    EDIT: fucking serious.... the fucker passing on as me on facebook is going around and talking shit about my elementary school classmates...
     
    #3594 Dan, Nov 15, 2007
    Last edited: Nov 15, 2007
  15. kdotc

    kdotc 안녕하세요빅뱅K-Dragon입니다

    so u woke up to go to the washroom but its too far so u went on the computer then pee in ur pants and went bak to sleep? =p
     
  16. dim8sum

    dim8sum ♫♪♫♪♫♪♫♪♫♪♫♪....

    so im the only one doing old skool FORTRAN :D
     
  17. fearless_fx

    fearless_fx Eugooglizer

    lmao, why would u bother with fortran? so outdated
     
  18. MissCheekS

    MissCheekS Reconnaîssant ❤

    Hahahahaa NOOO idiot...
    my laptop is on most of the times....and its on my bed....hehehe
    im not like u young man..who wets himself in his sleep yuckkkk
     
  19. fearless_fx

    fearless_fx Eugooglizer

    aiyah, u shouldnt run your laptop on your bed, the fans are all on the bottom, if u have it on the blankets it might overheat
     
  20. MissCheekS

    MissCheekS Reconnaîssant ❤

    ohhh..ehm i always do it and even now..its on my lap im sitting in my bed lol

    and the fans are on the left side i think cuz theres where hot air is comin out =/
     
Thread Status:
Not open for further replies.