Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   matching and convert program (http://www.go4expert.com/forums/matching-convert-program-t21161/)

nonie azlan 1Mar2010 13:56

matching and convert program
 
hello friends..

i'm new here.. and also new in C++.
if you can help me to solve this problem, please help.....

i have to create a matching program..

situation:
agency a need to send agency b a code of expression but agency b will read different code (look table below):

agency a send to agency b

expression code expression
01 love
02 angry
03 sad

agency b receive from agency a
expression code expression
01 angry
02 sad
03 love

what should i do t make these 2 agency understand and having a correct purpose of code? show me example of program that suitable...

techgeek.in 1Mar2010 20:52

Re: matching and convert program
 
The above problem seems to be the encoding and decoding type of problem. The sender sends the expression code with the expression jumbled up with code. This problem will be easily taken care of...
From the above example it is clear that the jumbling up is done "by rotation".. IF at the receiver end the code handles the string array such that it rotates the elements to the right then the actual code expression can be obtained. Try it now, if u cnt do then ask for the code..

nonie azlan 2Mar2010 06:34

Re: matching and convert program
 
huuhuu.. i don't know how to doing.. please help me..:nonod:

techgeek.in 2Mar2010 11:02

Re: matching and convert program
 
see this:-
Code:

# include<iostream.h>
# include<conio.h>

int expr_code[]={1,2,3};
char *exp[3]={"love","angry","sad"};

int main()
{
int choice,i,count=0;
int flag=1;
char *coded[3];
int j=0;
clrscr();
while(flag)
{
cout<<"press 1 if you are organisation A\n";
cout<<"press 2 if you are organisation B\n";
cout<<"press 3 if you want to exit\n";
cin>>choice;
switch(choice)
{
case 1:
cout<<"ready to send the codes to organisation B\n";
cout<<"actual data:- \n";

while(count<3)
{
cout<<expr_code[count];
cout<<exp[count];
cout<<"\n";
count++;
}


for(i=0;i<3;i++)
{

coded[j]=new char[10];
coded[j]=exp[(i+1)%3];
++j;

}
for(i=0;i<3;i++)
{
cout<<expr_code[i]<<" "<<exp[i];
cout<<"\n";
}

cout<<"data sent:- \n";
for(i=0;i<3;i++)
{
cout<<expr_code[i]<<" "<<coded[i];
cout<<"\n";
}



break;

case 2:
cout<<"ready to receive data from organisatin A";
cout<<"data received:-  \n";
for(i=0;i<3;i++)
{
cout<<expr_code[i]<<" "<<coded[i];
cout<<"\n";
}
    j=0;
 for(i=0;i<=3;++i)
 {
 exp[j]=new char[10];
exp[j]=coded[(i+2)%3];
j++;
  }
cout<<"actual data :  \n";
for(i=0;i<3;i++)
{
cout<<expr_code[i]<<" "<<exp[i];
cout<<"\n";
}

break;
case 3:
flag=0;
break;
}
}
getch();
return 0;
}


nonie azlan 2Mar2010 11:16

Re: matching and convert program
 
thanks a lot... but i found it like this... hmmm i can't run it...

--------------------Configuration: matching 02032010 - Win32 Debug--------------------
Build : warning : failed to (or don't know how to) build 'C:\Documents and Settings\Training.ICT-PC07-109\Local Settings\Temp\ARRAY.CPP'
Linking...
ARRAY.OBJ : error LNK2005: _main already defined in matching 02032010.obj
Debug/matching 02032010.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
Creating browse info file...

matching 02032010.exe - 2 error(s), 1 warning(s)

techgeek.in 2Mar2010 12:22

Re: matching and convert program
 
i have run the program in turbo c++..nd it is running fine...which compiler do u use??

nonie azlan 2Mar2010 14:27

Re: matching and convert program
 
i'm using Microsoft Visual C++ 6.0. am i run it to the correct way?

seangtz 3Mar2010 09:40

Re: matching and convert program
 
I have experience with using Microsoft Visual........:cuss:

nonie azlan 4Mar2010 09:43

Re: matching and convert program
 
hmmm... ok... i got u... so how? can't do anything ?? :nonod:

techgeek.in 4Mar2010 15:33

Re: matching and convert program
 
Quote:

Originally Posted by nonie azlan (Post 65097)
hmmm... ok... i got u... so how? can't do anything ?? :nonod:

have some patience..i m getting back to u soon...


All times are GMT +5.5. The time now is 12:17.