i have a problem in programing of linux


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu i have a problem in programing of linux
# 1  
Old 11-05-2011
i have a problem in programing of linux

i have problem in running of Linux programing .can i run this programing in ubuntu.
and what will be the procedure for that. please gave me a perfect suggestion.Smilie
# 2  
Old 11-05-2011
I really don't understand your question.

Can you please rephrase it, and with some more detail?

Thanks.
# 3  
Old 11-05-2011
covert this codig of linux

sir, please convert this coding according to ubuntu.after converting this coding they can run on ubuntu 10.05.





Code:
///**************************************************************************
   
  //                PROJECT: PRIVATE KEY CRYPTOGRAPHY
  //              DETAILS: USER ENTERED TEXT IS ENCRYPTED WITH THE
  //                            PRIVATE KEY PROVIDED BY THE USER AND DECRYPTED
  //                            ONLY IF THE SAME PRIVATE KEY IS ENTERED.
   
  /***************************************************************************/
   
  ///*************************************************************************
   
  //              INCLUDED HEADER FILES
   
  /***************************************************************************/
   
  #include<stdio.h>
  #include<iostream.h>
  #include<string.h>
  #include<unistd.h>
  #include<stdlib.h>
  ////************************************************************************
   
  ///                   CLASS  :ENCRYPTION
  //                    DETAILS:IT IS THE BASE CLASS CONTAINING ALL THE
  //                            FUNCTIONS FOR ENCRYPTION OF ENTERED TEXT
   
  /**************************************************************************/
  class encryption
    {
  protected:
  char *private_key;
  char encry[100];
  char password[10];
  char temp[10];
  int p,q,t;
  public:
  int i,j;
  char array[100];
  char text[100];
  void gettext();
  void show_encr_text();
  void encrypt();
  void hashing();
    };
   
   
   
  ////*************************************************************************
   
  ///                    CLASS: DECRYPTION
  //                     DETAILS: IT IS PUBLICALY DERIVED FROM CLASS ENCRYPTION.
  //                                  IT CONTAINS ALL THE FUNCTOINS REQUIRED FOR
  //                                  DECRYPTION OF TEXT.
   
  /****************************************************************************/
   
  class decryption:public encryption
   {   char  *pass;
  public:
  void get_encr_text();
  void decrypt();
  void decr1();
  void show_decr_txt();
   };
   
  ////*****************************************************************************
   
  ///                 FUNCTION NAME:GETTEXT()
  //                  BELONGS TO CLASS ENCRYPTION
  //                  DETAILS: IT TAKES THE TEXT TO BE ENCRYPTED BY THE USER AND
  //                           THERE PRIVATE KEY.
   
  /********************************************************************************/
   
   
  void encryption::gettext()
   {
  cout<<"\n\n\nEnter text to be encrypted: \n"<<endl;
  cin>>text;
   
  private_key=getpass("Enter private key: \n");
  cout<<endl;
   
   }
   
   
  ////*******************************************************************************
   
  ///                 FUNCTION NAME: ENCRYPT()
  //                  BELONGS TO CLASS ENCRYPTION
  //                  DETAILS: IT ENCRYPTS THE TEXT USING THE PRIVATE KEY
   
  /**********************************************************************************/
   
   
   
   
  void encryption::encrypt()
  { p=strlen(private_key);
     t=strlen(text);
     q=t/p;
  for(i=0;i<t;i++)
      {encry[i]=text[i]+7;
      }
  for(i=0;i<t;i++)
    {array[i]=encry[t-i-1];}
  for(i=0;i<t;i++)
  {encry[i]=array[i];}
   
  for(i=0,j=0;i<t,j<p;i=i+q+1,j++)
  { temp[j]=encry[i];
  encry[i]=private_key[j];
   
      }
   }
   
   
  ////*******************************************************************************
   
  ///                 FUNCTION NAME: SHOW_ENCR_TEXT()
  //                  BELONGS TO CLASS ENCRYPTION
  //                  DETAILS: IT SHOWS THE ENCRYPTED TEXT
   
  /**********************************************************************************/
   
   
  void encryption::show_encr_text()
  { cout<<"\nEncrypted text is: ";
  for(i=0;i<t;i++)
  { cout<<encry[i];
        }
     }
  ////*******************************************************************************
   
  ///                 FUNCTION NAME:GET_ENCR_TEXT()
  //                  BELONGS TO CLASS DECRYPTION
  //                  DETAILS:IT ASKS FOR PRIVATE KEY TO DECRYPT.
   
  /**********************************************************************************/
   
   
   
  void decryption::get_encr_text()
     {
  pass=getpass("\n\n\nEnter private key to decrypt: ");
   
     }
   
   
   
   
  ////*******************************************************************************
   
  ///                 FUNCTION NAME:DECR1()
  //                  BELONGS TO CLASS DECRYPTION
  //                  DETAILS:IF THE KEY ENTERED BY USER MATCHES WITH THE KEY
  //                               OF ENCRYPTION,IT DECRYPTS THE DATA; OTHERWISE
  //                          PRINTS A MESSAGE SAYING WRONG KEY.
  //
   
  /**********************************************************************************/
   
   
  void decryption::decr1()
     {
  for(i=0,j=0;i<t,j<p;i=i+q+1,j++)
              {
              password[j]=encry[i];
              encry[i]=temp[j];
              }
            cout<<" ";
              cout<<" ";
        //    cout<<"tmp"<<temp;
   
  for(i=0;i<t;i++)
   {cout<<encry[i];}
  /  cout<<"\n\n"<<pass;
   
              if (strcmp(password,pass)==0)
                    {   cout<<" ";
                          decrypt();
   
                    }
              else
              cout<<"\nYOU ENTERED WRONG PRIVATE KEY";
   
   
     }
   
   
  ////*******************************************************************************
   
  ///                 FUNCTION NAME:DECRYPT()
  //                  BELONGS TO CLASS DECRYPTION
  //                  DETAILS:IT SHOWS THE DECRYPTED TEXT WHEN THE
  //                          IS CORRECT. 
   
  /**********************************************************************************/
   
   
   
  void decryption::decrypt()
    {
  for(i=0;i<t;i++)
        {array[i]=encry[t-i-1];}
  for(i=0;i<t;i++)
        {encry[i]=array[i];}
   
  for(i=0;i<t;i++)
              {  text[i]=encry[i]-7;
               }
  cout<<"\n\nDecrypted text: "<<text;
  hashing();
     }
   
   
   
  ////*******************************************************************************
   
  ///                 FUNCTION NAME:HASHING()
  //                  BELONGS TO CLASS ENCRYPTION
  //                  DETAILS:IT CALCULATES THE HASH VALUE OF TEXT.
   
  /**********************************************************************************/
  void encryption::hashing()
    {
              int counti=0,counta=0,counte=0,counto=0,countu=0,count=0,hash=0;
  for(i=0;i<t;i++)
              {
              if(text[i]=='a')
              counta++;
              else if(text[i]=='i')
              counti++;
              else if(text[i]=='e')
              counte++;
              else if(text[i]=='o')
              counto++;
              else if(text[i]=='u')
              countu++;
              }
  count=counta+counte+counti+counto+countu;
  hash=(count/p)*17;
  cout<<endl<<"Hash Value= "<<hash;
    }
  ////*******************************************************************************
   
  ///                 FUNCTION NAME:MAIN()
  //                  DETAILS: MAIN FUNCTION....
   
  /**********************************************************************************/
  void main()
  {  system("clear");
  decryption E;
   
  int choice;
  char ch;
  do
       {
  cout<<"\n\n\n\nEnter if u want to\n\n1.Encrypt \n\n2.Decrypt"<<endl;
  cin>>choice;
  switch(choice)
              {
              case 1:
              E.gettext();
              E.encrypt();
              E.show_encr_text();
            E.hashing();
              break;
              case 2:
              E.get_encr_text();
            E.decr1();
               break;
              default:
              break;
         }
  cout<<"\n\n\n\nDo you wish to continue? y/n"<<endl;
  cin>>ch;
  }while(ch=='y'||ch=='Y');
  char c;
  cin.get(c);


Last edited by pludi; 11-05-2011 at 03:06 PM..
# 4  
Old 11-05-2011
First of all, please use [CODE] tags when posting code or command lines.

Second, we won't do your work for you. Tell us the specific problems you're encountering, and we'll try to help you with that. If you don't want to do the work yourself, hire someone, but don't expect any help from us.
# 5  
Old 11-06-2011
linux problem

when i write this code on ubuntu then error message can print and result cannot displayed. now what is problem ?
Smilie
# 6  
Old 11-06-2011
That description is about as useful as telling your doctor that you're hurting, but not where or what you've done. And honestly, I'm tired of people expecting us to invest time in their problems without giving us a good, reproducible description of it.

If you want our help, invest some time and effort. Give us a good description. Give us information on how to reproduce your problem. So far you haven't even given us any information on what this snipped of code should do.
If you don't want to invest time and effort, prepare to invest money instead and hire someone.
# 7  
Old 11-06-2011
problem in running program

when i write the coding in ubuntu and run then following error are displayed:
Code:
project.cpp:17:21: error: iostream.h: No such file or directory

project.cpp: In member function ‘void encryption::gettext()’:

project.cpp:79: error: ‘cout’ was not declared in this scope

project.cpp:79: error: ‘endl’ was not declared in this scope

project.cpp:80: error: ‘cin’ was not declared in this scope

project.cpp: In member function ‘void encryption::show_encr_text()’:

project.cpp:129: error: ‘cout’ was not declared in this scope

project.cpp: In member function ‘void decryption::decr1()’:

project.cpp:172: error: ‘cout’ was not declared in this scope

project.cpp:178: error: expected primary-expression before ‘/’ token

project.cpp: In member function ‘void decryption::decrypt()’:

project.cpp:213: error: ‘cout’ was not declared in this scope

project.cpp: In member function ‘void encryption::hashing()’:

project.cpp:244: error: ‘cout’ was not declared in this scope

project.cpp:244: error: ‘endl’ was not declared in this scope

project.cpp: At global scope:
project.cpp:252: error: ‘::main’ must return ‘int’

project.cpp: In function ‘int main()’:

project.cpp:260: error: ‘cout’ was not declared in this scope

project.cpp:260: error: ‘endl’ was not declared in this scope

project.cpp:261: error: ‘cin’ was not declared in this scope

project.cpp:281: error: ‘cin’ was not declared in this scope


Last edited by fpmurphy; 11-06-2011 at 01:45 PM.. Reason: code tags please!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

socket programing-problem with server

hi, i am new to socket programming.i have a problem in server.requirement is it should continuosly read the requests from client(sends requests continuously) and after certain delay(i kept der sleep) should send response. for this i used msgqueues so that after reading it is sending into... (1 Reply)
Discussion started by: chandinisree
1 Replies

2. Post Here to Contact Site Administrators and Moderators

socket programing-problem with server

hi, i am new to socket programming.i have a problem in server.requirement is it should continuosly read the requests from client(sends requests continuously) and after certain delay(i kept der sleep) should send response. for this i used msgqueues so that after reading it is sending into... (1 Reply)
Discussion started by: chandinisree
1 Replies

3. Programming

Unicode programing in C

im starting to go a little serious with c, woking in a personal project that will read a xml, which might contain Unicode characters (i know it will on my system, which is set to es_AR.UTF-8) im using mxml, and the documentation says it uses utf8 internally (no worries here). so i need to be... (4 Replies)
Discussion started by: broli
4 Replies

4. IP Networking

Netork programing

Hello experts, please help me as i want to learn the networking concepts in details , as i come know Unix network programming by Richard Stevens volume 1,2 is good please any of you downloaded the Free PDF version of it please direct m e as i want to download these books or the pdf form of it,... (1 Reply)
Discussion started by: vin_pll
1 Replies

5. Shell Programming and Scripting

shell programing...

Hi... i need to write a shell script wich shows the full name and station of every logged user in the system. pls help! (1 Reply)
Discussion started by: relu89
1 Replies

6. Shell Programming and Scripting

Awk Programing (need help)

plx help to solve these problems?? 1. Create a HERE document which will edit multiple files in the same directory, using the ed editor. I give you 3 original files: file1.c , file2.c , file3.c, download them and change each string "stdio.h" to "STDIO.H" in these files. Note: when execute the... (1 Reply)
Discussion started by: SoCalledEngr
1 Replies

7. HP-UX

crontab programing

How can program at crontab dayly each 30 minut (2 Replies)
Discussion started by: petroleo
2 Replies

8. Linux

Linux game programing or just shell scripting

Well Acording to my job... Anyhelp plz. I need some basic scripting stuff. (3 Replies)
Discussion started by: Irish Jimmy
3 Replies

9. Programming

Win programing

I am having a windows and i would like to know whitch program do you prefer for programing in windows P.S. C++ (1 Reply)
Discussion started by: D.Borak
1 Replies

10. UNIX Desktop Questions & Answers

Graphics programing

Hi all! I`m new in Unix (Linux) and i whant to ask something! What language should i use for Linux developing.I meen applications an GAME DEVELOPING! Should i use C,TCL ??? Please help me on this ...:( (1 Reply)
Discussion started by: Sebastyan
1 Replies
Login or Register to Ask a Question