• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What do you want?
#22
(20-11-2010, 06:54 PM)Drumm Wrote: [code=c]#include <iostream>
using namespace std;

int main(){
cout << "Hello World";
return 0;
}[/code]
Way to kill an hour 'eh ?

I'm slightly more advanced than that, but I still would like to get Pack3t SynAck3r's take on the language. Here is a program I wrote that changes a color bitmap to greyscale. Only that one size though, because that's all I need. You can see I built it off of a 'hello world' program.

Code:
/****************************************************************************
*                                                                          *
* File    : main.c                                                         *
*                                                                          *
* Purpose : Console mode (command line) program.                           *
*                                                                          *
* History : Date      Reason                                               *
*           00/00/00  Created                                              *
*                                                                          *
****************************************************************************/

#include <stdio.h>

/****************************************************************************
*                                                                          *
* Function: main                                                           *
*                                                                          *
* Purpose : Main entry point.                                              *
*                                                                          *
* History : Date      Reason                                               *
*           00/00/00  Created                                              *
*                                                                          *
****************************************************************************/

int main(int argc, char *argv[])
{


    FILE *readf; FILE *writef; int x;int txt[57655]; int h; char i;

    readf = fopen ("real eye.bmp","r") ;





if (readf != NULL)
{
    for(x=0;x<57654;x++)
        {
        txt[x] = fgetc(readf);


        }
}
else
{
printf("Unable to open READ file!\n");    
    scanf("%c",&i);
}




    for(x=54;x<57652;x=x+3)
        {



        h=0.3 * txt[x+1] + 0.59 * txt[x+1] + 0.11 * txt[x+2];


        txt[x]=h;txt[x+1]=h;txt[x+2]=h;


    



        }









    writef = fopen ("grey.bmp","w") ;

if (writef != NULL)
{
    for(x=0;x<57654;x++)
        {
        fputc(txt[x],writef);
        }
}
else
{
printf("Unable to open WRITE file!\n");
    scanf("%c",&i);    
}

   printf("Hello, world!\n");


    return 0;
}

All that white space is there from the influence of, the very toyt like a tiger, Python. The comment header was added by Pelles C, which I am in love with. Sadly the program hits the EOF pitfall, occasionally when I am filming in the dark. Haven't figured that out yet.
Having long hair is great until you have to pull a footlong out of the dog's butt. flatank.blogspot.com
I. AM. LATCH.
  Reply


Messages In This Thread
What do you want? - by Mark - 08-07-2010, 01:02 AM

Forum Jump: