Friday, September 23, 2011

A program to concatenate 2 strings

#include<stdio.h>
main()
{
char str1[40],str2[40];
int pos,count1,count2;

printf("\n Enter the first string: ");
scanf("%s",&str1); /*enter string 1*/

printf("\n Enter the second string: ");
scanf("%s",&str2); /*enter string 2*/

for(count1=0;str1[count1]!='\0';count1++)
{
;
}
pos=count1;
for(count1=pos,count2=0;str2[count2]!='\0';count1++)
{
str1[count1]=str2[count2++];
}
str1[count1]='\0';
printf("\n Concatenated string is %s",str1); /*print result*/
}

Monday, September 19, 2011

Types of Programming Language

The 12 most widely used languages:
  • C
  • Java
  • C++
  • PHP
  • Visual Basic
  • C#
  • Python
  • Perl
  • JavaScript
  • Embarcadero Delphi
  • Objective-C
  • Ruby

Types of Programming

There are some types of programming
  • Compiler optimization
  • Concurrent programming
  • Declarative programming
  • Event-driven programming
  • Functional programming
  • Imperative programming
  • Literate programming
  • Object-oriented programming
  • Parsing

Programming Language

Different programming languages support different styles of programming (called programming paradigms). The choice of language used is subject to many considerations, such as company policy, suitability to task, availability of third-party packages, or individual preference. Ideally, the programming language best suited for the task at hand will be selected. Trade-offs from this ideal involve finding enough programmers who know the language to build a team, the availability of compilers for that language, and the efficiency with which programs written in a given language execute. Languages form an approximate spectrum from "low-level" to "high-level"; "low-level" languages are typically more machine-oriented and faster to execute, whereas "high-level" languages are more abstract and easier to use but execute less quickly. It is usually easier to code in "high-level" languages than in "low-level" ones.
Allen Downey, in his book How To Think Like A Computer Scientist, writes:
The details look different in different languages, but a few basic instructions appear in just about every language:
  • input: Get data from the keyboard, a file, or some other device.
  • output: Display data on the screen or send data to a file or other device.
  • arithmetic: Perform basic arithmetical operations like addition and multiplication.
  • conditional execution: Check for certain conditions and execute the appropriate sequence of statements.
  • repetition: Perform some action repeatedly, usually with some variation.
Many computer languages provide a mechanism to call functions provided by libraries such as in a .so. Provided the functions in a library follow the appropriate run time conventions (e.g., method of passing arguments), then these functions may be written in any other language.

What is Programming

Computer programming (often shortened to programming or coding) is the process of designing, writing, testing, debugging and maintaining the source code of computer programs. This source code is written in a programming language. The purpose of programming is to create a program that exhibits a certain desired behavior. The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic.