Advertisements
Showing posts with label C Language. Show all posts
Showing posts with label C Language. Show all posts

Wednesday, April 23, 2014

// // Leave a Comment

Running DOS or C/C++ in Full Screen in Windows 7 or 8

Hi,

If you are a developer, of learning programming languages, you must have to deal with Turbo C/C++ compiler. On the early days of Learning, we have used Windows XP which have ability to run Command Prompt (MS DOS) in full screen mode. But Microsoft has ended support to Windows XP and released 4 new operating system after Windows XP. The major change in newer versions is that, they do not support MS DOS in full screen mode.

Now the requirement is, if you have to work on C/C++ application, you have to work in minimized screen. To make it full screen, we have an application named DOSBox, which is open-source and cross platform.
Below is step by step guide to install and configure DOSBox.

  • Download and Install DOSBox from http://www.dosbox.com/download.php?main=1.
  • After installing open DOSBox from menu.
  • You will see following screen.
  • Type following command to load Turbo C compiler in DOSBox.
    MOUNT C C:\TC ⏎
    C: ⏎
    CD BIN ⏎
    TC ⏎
    

Description of Code:

Line 1: MOUNT C C:\TC : Mounts C:\TC (where Turbo C is located) as C Drive. You can choose any drive that exists in your system. This will not effect your existing files.
Line 2: C: : Navigated to C Drive.
Line 3: CD BIN Navigated to Folder BIN normally as we do in MS - DOS.
Line 4: TC Run the Turbo C/C++ Compiler IDE located inside BIN folder.


Lets make it full screen.
Do not forget to change the Directory options from Options menu so that Include directories work fine.
If you find this article helpful, do share with your friends. If you have any suggestions or comments, let us know. We will read and improve ourselves.
John Bhatt
Read More

Saturday, December 31, 2011

// // Leave a Comment

Printing a Triangle in C Language...

Hi, Welcome back, Today I am back with a New C Program, Which will print an Triangle as below * ** *** **** *****

Code:

#include
#include
 
void main()
 {
  int i, j;
  clrscr();
  for(i=0;i<=5;i++)
   {
     for(j=1;j<=i;j++)
      {
        printf("*");
      } 
     printf("\n");
   }
  getch();
 }
Now Let's Illustrate above code.

Description:

  • First 2 Lines are Pre-Processor Directives as you are already familiar with them.
  • We started our Main section of Program. with void main(). Void is being used because we are not going to return any values.
  • We have defined two Variables of Integer Type named i and j.
  • clrscr() -- Clear Screen Function is for Clearing the DOS screen which will appear while we Run program.
  • Now We take First for Loop here. Which we will use to print New Rows. Detail : for(i=0;i<=5;i++). [ i=0; Variable i is initialized with Value 0. i<=5; i will continue up to value 5. Because we have to print Asterisks (*) in Five Rows. i++; This Operator is used to Increment value of i by 1 every time.]
  • Once another for loop is used with Variable j. We have used this to print Columns. Details : for(j=1; j<=i;j++). [ j=0; Variable j is initialized with Value 0. j<=i; j will continue up to value of i. (i.e. According to Rows) Because we have to print Asterisks (*) according to Number of Rows. j++; This Operator is used to Increment value of j by 1 every time.]
  • printf("*"); -- This command will print * in the Screen according to loop mentioned in above (No. 6).
  • Printf("\n"); -- This command will print new blank line when needed. i.e. According to first for loop.
  • getch(); -- This is a function which is an Input Function. We use this for input of Passwords or such data which does not display in screen. We have just used this here to Hold Screen. So that we can see the output.

If you have some questions about above tutorial or other questions, You can comment below or directly mail me at john@johnbhatt.com. I will surely help you. Its my promise. Lets Enjoy Learning together.... Ehhhh... Happy New Year 2012....


John Bhatt
P.Yar.B Complex
Read More

Thursday, October 27, 2011

// // Leave a Comment

Keywords in C Language


Hi,
Today I am back here to share all the keywords of C language with you.
Keywords are predefined or reserved words which are used for a particular task like to declare a variable, or to return values, looping, etc. We use these keywords in various way.
  1. AUTO
  2. BREAK
  3. CASE
  4. CHAR
  5. CONST
  6. CONTINUE
  7. DEFAULT
  8. DO
  9. DOUBLE
  10. ELSE
  11. ENUM
  12. EXTERN
  13. FLOAT
  14. FOR
  15. GOTO
  16. IF
  17. INT
  18. LONG
  19. REGISTER
  20. RETURN
  21. SHORT
  22. SIGNED
  23. SIZEOF
  24. STATIC
  25. STRUCT
  26. SWITCH
  27. TYPEDEF
  28. UNION
  29. UNSIGNED
  30. VOID
  31. VILATILE
  32. WHILE
These keywords are used to define variable and call function and to do all basic tasks that can be done using ‘C’.
Keep providing feedback…
Read More
// // Leave a Comment

Data Types in C Language

As in earlier posts I have introduced you with C Language. C language is the worlds most used and very powerful language for making Windows Application also Unix and Linux applications.

We have basically five data types in C Language. These are as following:

Character: char

Integer: int

Float: float

Double: double

Void: void
Read More

Monday, October 24, 2011

// // Leave a Comment

Simple Program Adding Two Veriables

Here is a simple program that will print sum of two variables. As you learnt in previous post, you will include header file(s) then open body of program.



#include

#include

void main()

{

int a=5,b=7,c;

c=a+b;

printf("Sum of Two Number is %d.",c);

getch();

}

We will discuss about data types in next post. Keep checking.

Read More
// // Leave a Comment

Introduction to C Language

C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.C is one of the most popular programming languages of all time and there are very few computer architectures for which a C compiler does not exist. C has greatly influenced many other popular programming languages, most notably C++, which began as an extension to C.


Structure of C Program


This is simple example program written in C language and details are described with Line as comments.

      #include        //Header Files  
      #include         
      void main()           //Main Function
      {                  // Opening Parenthesis
      printf("Hello World.");      //Statement
      }                    // Closing Parenthesis


Here in above program // are used to write comments.
Above program will display Hello World.
# sign is called Pre-processor and used to process files included at first. We included two header files above. Since we have put these files against # (Pre-processos) C Compiler first process Header files and then Program.
Keep visiting, More entries are being written.


Read More