Saturday, December 31, 2011

Beginner's Typing Test !


I was supposed to take a typing test of my two little student. I thought how shall I make it !!!
Its not a matter of pen & pencil !! Finally I decide to write my own code. Its finished and
I am so happy now. : )


I am very thankful to Muntasir Muzahid Chowdhury, my senior and FORTH-RIGHT for
helping me and showing me the right path....

Credit: Muntasir Muzahid Chowdhury
          & FORTH-RIGHT 
Project Description:
This test uses "a s d f j k l ;" these eight buttons. You can add as much as you can. It has 5 levels
and each level contains 5 sub-levels. Total score is 5*5=25. A timer is included and all result is
written in a text file named "Result.txt" where the .exe file belongs.
So, here is the code...
#include<stdio.h>
#include<string.h>
#include<time.h>
#include<stdlib.h>
#include<math.h>
#include <time.h>

int score=0;
int length=3;

int flevel()
{
int sublevel=5,sub_score=0;;
char arr[20]={'R','U','E','I','i','u','r','e','T','A',';','F','J','Y','L','G','H','\0'};
    char tmp[10];
char tmp2[10];clock_t start=clock();
while(sublevel--)
{
int j=0;
for(int i=0;i<length;i++)
{
   tmp[i]=arr[rand()%17];
   tmp[++j]=' ';
}
tmp[j]=NULL;
puts("");
printf("\t%s\n\t",tmp);
scanf("%s",tmp2);
if(strcmp(tmp2,tmp)==0){
sub_score++;score++;}
else
puts("\a\a\tWrong Answer\a\a!");
}
length++;
printf("Score: %d",sub_score);
printf("\nTime = %.2f secondes\n", (double)(clock()-start)/CLOCKS_PER_SEC);
return 0;
}
int writefile(char name[],double &a)
{
FILE *fp;
fp=fopen("Result.txt","a+");
fputs("\n==========================\n",fp);
fputs(" Beginner's Typing Test 4 \n",fp);
fputs("==========================\n",fp);
time_t timer = time(NULL);
fprintf(fp,"TIME: %s\n", ctime(&timer));
fputs("\n============================",fp);fflush(fp);
fprintf(fp,"\nName: %s",name);
fprintf(fp,"\nTotal Score: %d",score);
fprintf(fp,"\nTotal time = %.2f secondes\n", a);
fputs("============================\n",fp);
fclose(fp);
return 0;
}
int main()
{
    puts("==========================");
    puts(" Beginner's Typing Test 4 ");
    puts("==========================");
    puts("LEVELS 5 : SCORE (5*5)=25");
puts("==========================");
    int cases;
    printf("How Many Examinee(s)?: ");
    scanf("%d",&cases);
    while(cases--)
    {
char name[30];score=0;length=3;
puts("");puts("");
puts("===============================");
printf("Enter Your Name: ");
scanf("%s",name);
puts("===============================");
printf("\nGet Ready %s !!!\n",name);
system("pause");
        int level=5,levelcase=1;
clock_t start=clock();
        while(levelcase<=level)
        {
            printf("\n\tLEVEL: %d\n",levelcase++);
puts("============================");
            flevel();
        }
puts("");puts("");
puts("============================");
printf("Total Score: %d\n",score);
double a=(double)(clock()-start)/CLOCKS_PER_SEC;
printf("\nTotal time = %.2f secondes\n", a);
puts("============================\n\n");
        writefile(name,a);system("pause");
    }
system("pause"); return 0;

}
The Code is working fine as a Beginner's TYPING Test !!! Obviously you can change or upgrade this and Please give me the upgraded code...  :D
If you want your own app then send me a mail with your requirements.
This sample can be used as a COMPLEX TYPING TEST.... 

Thank you for reading this post. I am so beginner also and if you have any questions or suggestions please post a comment or mail me.
Enjoy Safe Computing.

Sunday, December 25, 2011

Data Type (View Size)

Credit : FORTH-RIGHT (http://forth-right.blogspot.com)
Using this code you can check your size of data types in your compiler.

#include<stdio.h>
#include<string.h>

int main ()
{
    int A[10];

    A[0]= sizeof(int);
    A[1]= sizeof (short int);
    A[2]= sizeof(long);
    A[3]= sizeof(float);
    A[4]= sizeof(double);
    A[5]= sizeof(long double);
    A[6]= sizeof(char);
    A[7]= sizeof(unsigned long);
    A[8]= sizeof(long long int);

    printf("Default\t\t%d\n",A[0]);
    printf("Short\t\t%d\n",A[1]);
    printf("long\t\t%d\n",A[2]);
    printf("float\t\t%d\n",A[3]);
    printf("double\t\t%d\n",A[4]);
    printf("long double\t%d\n",A[5]);
    printf("char\t\t%d\n",A[6]);
    printf("unsigned long\t%d\n",A[7]);
    printf("long long int\t%d\n",A[8]);

    getchar ();
    return 0;
}

OUTPUT:
Visual Studio 2010


Forth-Right: How to Pass Arguments to Functions Using "Call By Reference"

Click This Button To Read The Main Article:

"When learning C many people face problem with pointers. "Call by Pointers" seem complicated to some people. So for those, who are looking for easier way to get by (though they both seem same to me), here is details of passing arguments using "Call by Reference"......."


Forth-Right.blogspot.com



Saturday, December 17, 2011

The Oxford Thesaurus

An A-Z Dictionary of Synonyms


C Programming



Finally, I have decided to start again with C programming. I will discuss about things some other day but now I want to share Digit Conversion Program using function & case control structure.


***The continue_exit function does not directly exit.


Digit Conversion: (using Function & Case Control)

Friday, December 16, 2011

Make your own Folder Locker/Folder Guard



After a long gap, I am on blogger again! This time I am here with Folder locker!!

Firstly,I found this content on internet but can not remember the site name. So I apologize to the coder!

There's a lot of "Folder Lockers / Folder Guards / Folder Protectors" etc software over the internet. But the problem is that most of them are not secured and most of the time can be broken easily.


Why need of a Folder locker?
Its important for you to have some privacy on your PC you don't want to show others. That's why these applications keep protects your folders could not be seen by anyone.


So, why this?
Imagine, you need a Folder Locker software and to get full protection you need to buy that!
On the other hand you have your own codes and you make your 
1. Own Folder Lockers every time. 
2. No need to buy.
3. You can change the codes.
4. You can change the Title.
5. Give you full protection.
6. Finally you are the master of that. (I think you got understand what I am saying)


Here it is....
Just follow the instructions. Trust me it's simpler than you think.

Instructions:
1. Open notepad (start>all programs>accessories>notepad or C://windows/notepad.exe)
2. Copy the code below into notepad.
3. Replace "type your password here" with your Password.
4. Save as "Name.bat"
Complete!!! See I told you its too easy.

Now, how will it work?
Double clicking on "Name.bat" you will get a folder named "Locker". Put your private files or folders inside this "Locker". Again clicking on "Name.bat" a command prompt will open. Type 'y' to lock and see the magic.

Windows XP
Windows Seven
cls
@ECHO OFF
title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure and want to Lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%=="type your password here" goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End
cls
@ECHO OFF
title Folder Locker
if EXIST "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure and want to Lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Locker "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}"
attrib +h +s "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%=="type your password here" goto FAIL
attrib -h -s "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}"
ren "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End
Thanks - Jajabor, 2014