View Single Post
Old 18-09-2007, 03:40 AM   #164 (permalink)
Quiz_Master
* Teh Flirt King *
 
Quiz_Master's Avatar
 
Join Date: Dec 2005
Location: Originally From : Ratlam M.P., Currently in: Hyderabad
Posts: 972
Default Re: Post ur C/C++ Programs Here

Here is my todays Homework : (Just complted this late in night...uhmm... sorry morning... )
Its a fairly simple program...

This is a program which compare two strings, concatenate them and then gives the length of string.

Code:
/* Program to compare, concatenate and get length of string by Ashwin */

#include<iostream.h>
#include<conio.h>
#include<string.h>
main()
{
   clrscr();
   char a[50],b[25];
   cout<<"Enter First String:=  ";
   cin>>a;
   cout<<"Enter Second String:=  ";
   cin>>b;
   if (strcmp(a, b) ==0)
   cout<<"Both Strings are same.\n";
   else
   cout<<"Both Strings are not same\n";
   strcat(a,b);
   cout<<"The Combined String Is:= "<<a;
   cout<<"\nThe length of string is:= "<<strlen(a);

   getch();
   return 0;
}
Thats it for now.... I know its very basic .... But maybe someone on this forum can use this for school homework.
(And I am ashamed to say that they teach us all this in college level )
__________________
World is just a Quizzical Reality : Quiz_Master//Ashwin :D

Blog: http://ashwinsaxena.com/blog - Tech, Life and Other Things.
Quiz_Master is offline