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

WTF

Name: Anonymous 2008-10-07 12:46

Hey /prog/ can anyone tell me what the hell is going on in this program?

#include <iostream>
using namespace std;

void fun (int data);
void mystery(int data);
void main( )
{
    int data;
    bool start =true;
   
    cout<<"Please enter an integer value : ";
    cin>>data;
    fun(data);
    mystery(data);
   
   
}

void fun(int count)
{
    char index = count;
    while(index >= 0)
    {
        cout<<index;
        index--;
    }
}

void mystery(int count)
{
    char index = count;
    while(index<count)
    {
        cout<<count;
        index++;
    }
}

Name: Anonymous 2008-10-07 12:53

It asks for a number.
It then prints text characters using the inputted number as the ascii code for the charachter and then loops down to 0.

Mystery is missing so it won't compile.
Fun's body should be a for loop.
Start is never used.

So I wouldn't pay too much attention to this simple but awful piece of code.

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