Pages

Sunday, April 6, 2014

7 Design numbers rectangle structure

Q. Write a program to generate a following numbers structure:
   (Where user entered number through keyboard, for example if num=5)

                                54321
                                54321
                                54321
                                54321
                                54321

Ans.

/* c program for symbol triangle*/
#include<stdio.h>
#include<conio.h>
int main()
{
 int num,r,c;
 printf("Enter loop repeat number(rows): ");
 scanf("%d",&num);
 for(r=1; num>=r; r++)
 {
  for(c=5; c>=1; c--)
     printf("%d",c);
  printf("
"
);
 }
 getch();
 return 0;
}
/*************OUTPUT**************
Enter loop repeat number(rows): 5

                                54321
                                54321
                                54321
                                54321
                                54321

***********************************/           
Read More..

Short Circuit operators

C language has two types short-circuit operators:

  1. Logical AND operator  &&
  2. Logical OR operator  ||
What is meaning of short-circuit


In C language, the meaning of short-circuit is that if there are any expression, then output of expression must be determined by the left side operand, and right side operand never be executed.
Here two case occurred,:
what would be output if left side operand is true?
what would be output if left side operand is false?

keep in mind: 0 or any negative value is always false.
                    1 or any non-zero value is always true.


Lets understand short-circuit operators by example:

x && y

hear, if left side operand x is false then overall expression to be false, and the right side operand y never evaluated.
If left side operand x is true then result of expression depend upon right side  operand y and in this case right side  operand will be evaluated.

m || n

here, if left side operand m is true then overall expression to be true, and right side operand n not to be evaluated.

Read following programs carefully:

/*c program for logical OR short-circuit operator example*/
#include<stdio.h>
int main()
{
 int x, y , z;
 x = y = z = 1;

 ++x || ++y;

 printf("
x=%d y=%d z=%d
"
, x,y,z );

 getch();
 return 0;
}

The output of above program would be:

x=2  y=1  z=1
explanations: In above program logical OR short-circuit operator, in expression left hand side operand x is true so its increase ++x i.e. x=2. And right side operand y not to be evaluated.

-------------------------------------------------------------------

/*c program for exercise of logical OR short-circuit operator operators*/


#include<stdio.h>
int main()
{
 int x, y , z;

 x = y = z = 0;

 ++x || ++y;

 printf("
x=%d y=%d z=%d
"
, x,y,z );

 getch();
 return 0;
}

The output of above program would be:

x=1  y=0  z=0
explanations: In above program logical OR short-circuit operator, in expression left hand side operand x is false so right side operand y not to be evaluated.


-------------------------------------------------------------------

/*c program for exercise of logical AND short-circuit operators example*/


#include<stdio.h>
int main()
{
 int x, y , z;

 x = y = z = 1;

 ++x && ++y;

 printf("
x=%d y=%d z=%d
"
,x,y,z );

 getch();
 return 0;
}

The output of above program would be:

x=2  y=2  z=1
explanations: In above program logical AND short-circuit operator, in expression left hand side operand x is true(++x) so right side operand y also evaluated(++y).


-------------------------------------------------------------------

/*c program for logical AND, logical OR short-circuit operators example*/

#include<stdio.h>
int main()
{
 int x, y , z, r;


 x = y = z = 1;
 r = ++x || ++y && ++z;
 printf("
r=%d"
, r);

 printf("
x=%d y=%d z=%d
"
, x,y,z);



 x = y = z = 1;
 r = ++x && ++y || ++z;
 printf("
r=%d"
, r);

 printf("
x=%d y=%d z=%d
"
, x,y,z);



 x = y = z = 1;
 r = ++x || ++y || ++z;
 printf("
r=%d"
, r);

 printf("
x=%d y=%d z=%d
"
, x,y,z);



 x = y = z = 1;
 r = ++x && ++y && ++z;
 printf("
r=%d", r);

 printf("
x=%d y=%d z=%d

", x,y,z);


 x = y = z = 1;
 r = ++x || ++y && ++z;
 printf("
r=%d"
, r);

 printf("
x=%d y=%d z=%d

", x,y,z);



 x = y = z = -1;
 r = ++x || ++y && ++z;
 printf("
r=%d"
, r);

 printf("
x=%d y=%d z=%d

", x,y,z);


 x = y = z = -1;
 r = ++x && ++y ||  ++z;
 printf("
r=%d"
, r);

 printf("
x=%d y=%d z=%d

", x,y,z);


 x = y = z = -1;
 r = ++x ||  ++y ||  ++z;
 printf("
r=%d"
, r);

 printf("
x=%d y=%d z=%d

", x,y,z);


 x = y = z = -1;
 r = ++x &&  ++y &&  ++z;
 printf("
r=%d"
, r);

 printf("
x=%d y=%d z=%d

", x,y,z);


 x = y = z = -1;
 r = ++x || ++y &&  ++z;
 printf("
r=%d"
, r);

 printf("
x=%d y=%d z=%d

", x,y,z);

 getch();
 return 0;
}

The output of above program would be:


Output of short circuit operators C program
Screen shot for logical AND, logical OR
short circuit operator C program


Read More..

Saturday, April 5, 2014

Simplicity Revisited

In my last post I explained that classic BASIC was implemented as an exploratory programming environment. It occurred to me that my earlier post about simplicity touches on an extremely important aspect of BASICs exploratory qualities.

List most software today, programming tools do 101+ things. This reminds me of a Nova documentary I saw about jet fighter planes. The cockpit of a modern jet fighter has more dials than a clock store and more buttons than a sewing shop. The documentary explained was that these were all there so that the pilot would be able to do lots of useful things. As it turns out, not many of the things in the cockpit are useful for flying an airplane in combat.

As an exploratory programming language, early BASIC was simple to learn. There was no GUI. Windows, icons and other graphical features do not always improve software (although they can). There were only a few commands and ideas that you needed to learn. Was this enough? Maybe not, but its simplicity is one of the essential concepts that made it successful.

"Perfection is achieved, not when there is nothing left to add, but when there is nothing left to take away." --- Antoine de St. Exupery, Wind, Sand, and Stars, 1939
Read More..

Friday, April 4, 2014

Artificial Intelligence and BASIC

When I was 13 or so years old I bought a book at You-Do-It Electronics titled Experiments in Artificial Intelligence for Small Computers, authored by John Krutch. This book influenced me in important ways. It teaches the essentials of AI so anyone could understand it. Examples are presented in the BASIC programming language. One of the examples presented is of the classic Eliza sort of conversational system. Not cutting edge research, but as a starter it gets the job done.

I was able to use the techniques in the book to create demos for the computers at NEECO. A person visiting the store would ask the computer about itself, and the computer would try and respond appropriately with a demonstration of features.

The book can still be purchased used on Amazon.
Read More..

Comparison of Computer Generation

There are five computer generation, the following table summarise all main features comparison of related generation as:


Features First Generation Second Generation Third Generation Fourth Generation Fifth Generation
Period 1946-1959 1959-1965 1965-1971 1971-1985 1985-now
Electronic Item Vaccum Tube Transistor Integrated Circuit Microprocessor VLSIC
Language Machine Assembly High Level Language High Level Language High Level Language
Storage Punch Card Magnetic Tape Internal Memory Internal Memory Internal Memory
Example ENIAC IBM-700, ATLAS PDP Seriess computer, CDC-1700 IBM-PC, ZX-SPECTRUM Super Computer, Robot
Read More..

Wednesday, April 2, 2014

Ferrari 550 Maranello Ferrari 550 Maranello 2000 Wallpaper 2

Ferrari 550 Maranello (16)

Ferrari 550 Maranello (17)

Ferrari 550 Maranello (18)

Ferrari 550 Maranello (19)

Ferrari 550 Maranello (20)

Ferrari 550 Maranello (21)

Ferrari 550 Maranello (22)

Ferrari 550 Maranello (23)

Ferrari 550 Maranello (24)

Ferrari 550 Maranello (25)

Ferrari 550 Maranello (26)

Ferrari 550 Maranello (27)

Ferrari 550 Maranello (28)

Ferrari 550 Maranello (29)

Read More..

Tuesday, April 1, 2014

Company of Heroes Overview

The love between game developers and world wars is no doubt a quixotic relationship and still continues to encourage game developers to create World War II inspired games, including - "COMPANY OF HEROES".(perhaps the one and only good thing wars have given us-inspiration to game developers)

But is the industry heading towards an overkill? We are in the year 2008, and have been bombarded with countless World War II based titles. Gamers are now becoming fed up of the same old theme being used and abused in every possible way! This is where Company of Heroes- opposing fronts comes in.

Opposing fronts (OF) is the standalone expansion to 2005s original Company of Heroes. This is a real time strategy game.

While CoH was based entirely on the American point of view, OF lets players decide between two factions in both single and multiplayer- The Allied British or the German Panzer Elite, each of these factions comes with its own pros and cons, and is perfectly balanced out.

THE ALLIED BRITISH:

The British army is the most cautious one, focusing on safety and defense tactics. There infantry prefers defensive stances which hinder their speed. The brits also heavily depend on firepower from the Cromwell tanks and Royal Artillery. The barrage and creeping barrage attacks are the most effective and need to be used extensively in order to mellow down the German defence.the British also tend to rely on mobile headquarter vans to keep supplying them with reinforcements and sappers or engineers who are infantrymen who can also repair damaged vehicles.

Another influential regiment in the British force is the royal commandos regiment. This regiment can deploy commandos whose only objective is harassing the enemy infantry. The light Tetrarch tank can also be deployed by this regiment (on of the most effective tanks in the game), through the means of a glider plane.

THE GERMAN PANZER ELITE:
True to Hitlers Blitzkrieg strategy the Panzer Elite mainly focuses on speedy attacks with the aid of numerous vehicles. Unlike the British, they cannot build entrenchments for defense, but can use halftracks to hold territory. The Germans also have the special ability to fire grenades, mounted weapons and heavy weaponry from inside the vehicles.

The Scorched earth tactic is the most conniving of all Elite tactics. Using this tactic, players can booby trap buildings and strategic points. Or even better, disable strategic points altogether. This little trick comes in handy when you are playing multiplayer, as by using this you can disable victory points as well. Since both factions are brilliantly balanced out, its quite a challenge to play with either of the two. The single player campaigns revolve around the battle of Normandy for the German prospective and liberation of Caen for the British prospective.

REQUIREMENTS:

• Windows xp/vista
• Dual core processor 2.5 GHz
• 256 MB video card (GEforce 7x/8x/9x series should do it)
• 1 GB ram

CONCLUSION:

Company of Heroes: Opposing Fronts is a brilliant gaming experience for both multiplayer and single players. The single player campaigns are detailed to perfection and have an immense entertainment value. The in-game battles are epic and truly bring in the authentic WWII feeling. The multiplayer mode is as usual great as usual especially with the interplayability factor. OF also has a dynamic weather system, which means you have to fight battles in the night time as well as in the daytime, and also in rainfall.

However this little gimmick has no effect on the overall gameplay. The game looks gorgeous as expected. Watching building explode and collapse while debris files all round was fun while the game ran in all its glory at our end.

The only flaw that we could find (if it can be called a flaw) is the reccuring world war 2 theme, which we mentioned earlier. Sure, we have had World in conflict, which is a strategy game set in the present/near future, but to have Company of Heroes - with its entire superb multiplayer and single player elements- set in the present word would be great.


By Ryan B
Read More..