• Forum
  • Lounge
  • Why is there so much programming stuff i

 
Why is there so much programming stuff in this lounge section

There are other forums for that.
I think it should be place to chill and talk crap
Being this a programming website, is likely that in the lounge the users ( who like programming ) will talk about programming
Some fun from a short while back, and how it relates to real life:

Makefile
1
2
soundex: main.cpp soundex.cpp soundex.hpp
	$(CXX) -Wall -pedantic -o soundex main.cpp soundex.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <string>
using namespace std;

#include "soundex.hpp"

int main()
  {
  string s;

  cout << "Enter a name per line to see it in Soundex.\n"
       << "Enter a blank line to quit.\n\n";

  while (true)
    {
    cout << "> " << flush;
    getline( cin, s );

    if (s.empty()) break;

    s = soundex( s );

    if (s.empty()) cout << "That is not a valid name" << endl;
    else           cout << s                          << endl;
    }

  return 0;
  }
soundex.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// soundex.hpp
//
// Copyright (c) 2008 Michael Thomas Greer.
//
// Boost Software License - Version 1.0 - August 17th, 2003
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

#ifndef DUTHOMHAS_SOUNDEX_HPP
#define DUTHOMHAS_SOUNDEX_HPP

#include <string>

std::string soundex( const std::string& s );

#endif

// end soundex.hpp 
soundex.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// soundex.cpp
//
// Copyright (c) 2008 Michael Thomas Greer.
//
// Boost Software License - Version 1.0 - August 17th, 2003
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

#include <algorithm>
#include <cctype>
#include <functional>
#include <string>

//----------------------------------------------------------------------------
namespace soundex_internal
  {
  char f_transform( char c )
    {
    std::string consonants[ 6 ] = { "BFPV", "CGJKQSXZ", "DT", "L", "MN", "R" };
    for (int i = 0; i < 6; i++)
      if (consonants[ i ].find( c ) != std::string::npos)
        return (i +1) +'0';
    return c;
    }
  }

//----------------------------------------------------------------------------
std::string soundex( const std::string& s )
  {
  std::string result;

  // Validate s
  if (std::find_if(
        s.begin(),
        s.end(),
        std::not1( std::ptr_fun <int, int> ( std::isalpha ) )
        )
      != s.end())
    return result;

  // result <-- uppercase( s )
  result.resize( s.length() );
  std::transform(
    s.begin(),
    s.end(),
    result.begin(),
    std::ptr_fun <int, int> ( std::toupper )
    );

  // Convert Soundex letters to codes
  std::transform(
    result.begin() +1,
    result.end(),
    result.begin() +1,
    soundex_internal::f_transform
    );

  // Collapse adjacent identical digits
  result.erase(
    std::unique(
      result.begin() +1,
      result.end()
      ),
    result.end()
    );

  // Remove all non-digits following the first letter
  result.erase(
    std::remove_if(
      result.begin() +1,
      result.end(),
      std::not1( std::ptr_fun <int, int> ( std::isdigit ) )
      ),
      result.end()
    );

  result += "000";
  result.resize( 4 );

  return result;
  }

// end soundex.cpp 


And a quick run about me and my beloved

D:\prog\cc\soundex> soundex
Enter a name per line to see it in Soundex.
Enter a blank line to quit.

> Melissa
M420
> Michael
M240
> Greer
G660
>

D:\prog\cc\soundex> _

See it? See it?

:-)
Last edited on
Well, that's a stupid question. What else are programmers going to talk about? Sport? "Did you see that ludicrous display last night?" and so forth?
Oooh! If you add 240 and 420 you get 660. It was meant to be!

If you put the M & G together you get MG660. And the MG-660 was a Casio gaming calculator from 1980. http://thegame.jellytip.com/user_pages/page.asp?art_id=426

You were destined to be Geeks in Love!
LOL. Someone who gets it! ;-)
closed account (S6k9GNh0)
1
2
3
//Bad birthday greetings.
#define void* are
int you(are gay); //Happy birthday! L] 
Last edited on
Lol.
That doesn't even work.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <iomanip>
#include <string>
#include "universe24.h"
using namespace std;

void ConvertUniverseToBinary(str universe) {
    setbase(2);
    int binaryUniverse=universe;
    cout<<"MWAHAHAHAAAAA!!!!!"<<endl;
};

int main() {
    ConvertUniverseToBinary(universe24);
    cout<<"\nI be teh grand mastehr OF TEH UNIVERSEYNESS!!! >:D"<<endl;
    cout<<binaryUniverse;
    cin.get();
    return 0;
}


I HAVE NO IDEA WHAT IS IN universe24.h , BUT I SURE WANT TO!!!!!
Topic archived. No new replies allowed.