--- jsdecastro28 <[EMAIL PROTECTED]> wrote:

> the problem is create a program that display the
> length of a string 
> and other is concatenate two string 
> 
> this is my program...my only problem is the
> concatenation
> 
> hope you will help me....ty
> 
> #include <iostream.h>
> #include <conio.h>
> 
> int length_str(char word[]);
> char cat_str(char word1[], char word2[]);
> 
> void main()
> {
>   clrscr();
>   char word[50],word1[50],word2[50];
>   int choice,z,y;
>   do{clrscr();
>   cout<<"\t\tSELECT YOUR CHOICES"
>       <<"\n\t [1] - tells number of characters the
> string has"
>       <<"\n\t [2] - Concatenation of string"
>       <<"\n\t [3] - Exit"
>       <<endl;
>   cin>>choice;
> 
>   clrscr();
>    switch(choice)
>     {
>       case 1: cout<<"Enter a word: ";
>             cin>>word;
>             z=length_str(word);
>             cout<<"The no. of characters the string has
> is: "<<z;
>             getch();
>             break;
>       case 2: cout<<"Enter 1st word: ";
>             cin>>word1;
>             cout<<"Enter 2nd word: ";
>             cin>>word2;
>             y=cat_str(word1,word2);
>             cout<<"the concatenation word is: "<<y;
>               getch
>             break;
>       case 3: cout<<"EXIT";
>               getch
>             break;
>      }
>    }while(choice == 1 || choice == 2);
> }
> int length_str(char word[])
> {
>   int i=0;
>   for(int j=0;word[j]!='\0';j++)
>   i++;
>   return i;
> }
> char cat_str(char word1[], char word2[])
> { char word3[100];
>   int i=0,hold;
>   hold=for(int j=0;word1[j]!='\0';j++)
>   
>   for(int j=0;word2[j]!='\0';j++)
>   word1[hold++]=word2[i];
>   
>   return y;
> 
> 
> }
> 

Please fix the program so it compiles. Numerous syntax
error exist.

What is the specific problem with the concatenation
function?



Mickey M.
Construction Partner Inc.
http://www.constructionpartner.com


       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for 
today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

Reply via email to