Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Let's write a C++ program.

Name: Anonymous 2008-07-19 16:14

Ok /prog/, Lets write a program.
I'll start.


#include <iostream>

Name: Anonymous 2008-07-19 16:16

#error No.

Name: Anonymous 2008-07-19 17:04

#define return int

Name: Anonymous 2008-07-19 17:32

int main ()

Name: Anonymous 2008-07-19 17:36

#define (( {
((
   return lambda_p;

Name: Anonymous 2008-07-19 17:36

{
    printf("The only way to make C++ tolerable is to use it to write in C.\n");
#undef return
    return EXIT_SUCCESS;
}

Name: Anonymous 2008-07-19 17:44

putStrLn "How did I get here I am not good with C++"

Name: Anonymous 2008-07-19 18:47

I used to write includes as a learning exercise for my friends, but they didn't bother to read them, so now I just have them zero out the hard drive of the user.

Name: Anonymous 2008-07-19 20:07

void HaxAnus(std::Anus anus)
{
   anus.Hax();
}

Name: Anonymous 2008-07-19 20:08

>>9
// On second thought, make this take std::Anus& anus

Name: Anonymous 2008-07-19 20:36

i had to write an assignment in c++ once
so i fucking make a c++ program that system("./my_c_program");

PWNED

Name: Anonymous 2008-07-19 20:44

>>11
Use of system considered harmful

PWNED

Name: Anonymous 2008-07-19 21:09

>>12
Actually, that system that I mentioned above is a system that I defined myself and it uses proper UNIX etiquette. I undefined the other default system call.

Name: Anonymous 2008-07-19 21:09

>>12
PWNED

Name: Anonymous 2008-07-20 5:21

PWNED
what is wrong with you

Name: Anonymous 2008-07-20 10:44

>>15
YBHT.

Name: Anonymous 2008-07-20 10:59

>>16
SPAWHBTP

Name: Anonymous 2008-07-20 11:07

>>17
wat

Name: Anonymous 2008-07-20 11:16

>>17
Undefined function: 'P'.

Name: Anonymous 2008-07-20 11:30

>>19
Pwnedfully.

Name: Anonymous 2008-07-20 11:36

SPA?

Name: Anonymous 2008-07-20 12:05

>>21
Socialistische Partij Anders.

Name: Anonymous 2008-07-20 12:08

>>22
Makes no sense.

Name: Anonymous 2008-07-20 12:12

>>17,18 same person

Name: Anonymous 2008-07-20 12:55

for_each(thread.posters().begin(), thread.posters().end(), mem_fun_ref(&Poster::HaxAnus));

Name: Anonymous 2008-07-20 13:02

>>25
That's the most inept attempt at syntax I've ever seen. What language were you aiming for there?

Name: 26 2008-07-20 13:05

>>25
Oh dear god that's valid C++?
Godammit I hate everyone.

Name: Anonymous 2008-07-20 13:06

>>26
Not too familiar with STL algorithms, are we?

Name: Anonymous 2008-07-20 13:09

>>28
More like FTL algorithms, amirite?

Name: Anonymous 2008-07-20 13:12

>>29
I see what you did there.

Name: Anonymous 2008-07-20 13:13

>>1
Oh! I know this one! I'll finish this right away!
#include <cstring>
#include <fstream>
#include <sstream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include "../../C03/8/WordIterator.cpp"

using namespace std;

void myPrintLn(string s) {
    cout << s << endl;
}

bool isWord(const char* s) {
    const size_t len = strlen(s);
    size_t i = 0;
    while(i++ < len && isalpha(s[i]));
    return i == len;
}

int main(int argc, const char** argv) {
    // Check if we've been given enough arguments
    if(argc < 3) {
        cout << "Usage: " << argv[0] << " <file_path> <word1> <word2> ..."
                << endl;
        return 0;
    }

    // Open the input file specified as the first argument
    ifstream file(argv[1]);
    if(file.fail()) {
        cout << "Error: Could not open file \"" << argv[1] << "\"" << endl;
        return 0;
    }

    // Open the output file
    ofstream outfile(string(argv[1]).append(".matches").c_str());
    if(outfile.fail()) {
        cout << "Error: Could not open output file \"" << argv[1]
                << ".matches\"" << endl;
        return 0;
    }

    // Here we will store words_sought given on the command line
    typedef set<string> sset;
    typedef vector<const char*> svector;
    sset words_sought;
    svector args;
    args.reserve(argc - 2);

    copy(argv + 2, argv + argc, back_inserter(args));
    // Check if all arguments are proper words
    svector::iterator bad_args = partition(args.begin(), args.end(),
                                           ptr_fun(isWord));

    // Some arguments contain characters not in the standard alphabet
    if(bad_args != args.end()) {
        cout << "These arguments are not words:" << endl;
        for_each(bad_args, args.end(), ptr_fun(myPrintLn));
        cout << "Continuing without them" << endl;
    }

    // Gather the rest of the arguments
    copy(args.begin(), bad_args, inserter(words_sought, words_sought.begin()));
    args.resize(0);    // We won't need this anymore

    istringstream line_stream;
    string line;
    size_t line_nr = 1;
    const WIT eoi;
    while(getline(file, line)) {
        line_stream.str(line);
        WIT word(line_stream);
        /* Search for matches word-by-word. Stop at the first match or
         * end-of-input
         */
        while(word != eoi && words_sought.find(*word) == words_sought.end())
            ++word;

        // Match! Print the whole line
        if(word != eoi) {
            outfile << line_nr << ' ' << line << endl;
        }
        ++line_nr;
    }
    return 0;
}

Name: Anonymous 2008-07-20 13:30

mem_fun_ref does exist and is valid Sepples.

I don't know what to say.

Name: SAGE 2008-07-20 13:48

meme_fun_ref?
Stop forcing stupid memes.
SAGE

Name: Anonymous 2008-07-20 13:52

>>33
ಠ_ಠ

Name: SAGE 2008-07-20 13:56

>>34
Yeah, this stupid meme forcing is out of control. meme_fun_ref doesn't even make any sense.
SAGE because this is stupid.

Name: Anonymous 2008-07-20 18:56

int x = flaming_rabid_shrew_cast<int>(new float(5.0f));

Name: Anonymous 2008-07-29 5:26

>>35
mem_fun_ref makes perfect sense. It's short for reference funny meme.

Name: SAGE 2008-07-29 9:12

>>37
That makes even less sense. GTFO WITH YOUR FORCED MEMES!!!
SAGE

Name: Anonymous 2011-02-04 11:55

<

Don't change these.
Name: Email:
Entire Thread Thread List