Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,158 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,080 people online right now. Registration is fast and FREE... Join Now!




C to Pascal - ummm how to change it

 
Reply to this topicStart new topic

C to Pascal - ummm how to change it, help me in my project ' protect passwords? '

soona
14 Dec, 2007 - 07:09 AM
Post #1

New D.I.C Head
*

Joined: 11 Dec, 2007
Posts: 4


My Contributions
hey
this program is " Encrypted password protected "
how can i change it to pascal using the while loop and array's rolleyes.gif


CODE
#include<iostream.h>

void main(){

char pwd;

cout<<"Please Enter your password to be enscripted:"<<endl;

while(cin>>pwd){


  if(pwd=='a'){
   cout<<"q";
  }
  else if(pwd=='b'){
   cout<<"g";
  }
    else if(pwd=='c'){
   cout<<"d";
  }

      else if(pwd=='d'){
   cout<<"e ";
  }
        else if(pwd=='e'){
   cout<<"3";
  }
          else if(pwd=='f'){
   cout<<"r";
  }
            else if(pwd=='g,'){
   cout<<"tSpace";
  }
              else if(pwd=='h'){
   cout<<"y";
  }
              else if(pwd=='i'){
   cout<<"8SpaceSpace";
  }
              else if(pwd=='j'){
   cout<<"u";
  }
              else if(pwd=='k'){
   cout<<"iSpace";
  }
              else if(pwd=='l'){
   cout<<"oSpaceSpaceSpace";
  }
              else if(pwd=='m'){
   cout<<"SpaceSpacej";
  }
              else if(pwd=='n'){
   cout<<"hSpace";
  }
              else if(pwd=='o'){
   cout<<"9";
  }
                else if(pwd=='p'){
   cout<<"0";
  }
    else if(pwd=='q'){
   cout<<"1";
  }
    else if(pwd=='r'){
   cout<<"4";
  }
    else if(pwd=='s'){
   cout<<"wSpace";
  }
    else if(pwd=='t'){
   cout<<"5";
  }
    else if(pwd=='u'){
   cout<<"7";
  }
    else if(pwd=='v'){
   cout<<"f";
  }
    else if(pwd=='w'){
   cout<<"2";
  }
    else if(pwd=='x'){
   cout<<"sSpaceSpace";
  }
    else if(pwd=='y'){
   cout<<"6";
  }
    else if(pwd=='z'){
   cout<<"a Space";
  }
      else if(pwd=='1'){
   cout<<"11a";
  }
        else if(pwd=='2'){
   cout<<"12b";
  }
          else if(pwd=='3'){
   cout<<"13c";
  }
            else if(pwd=='4'){
   cout<<"14d";
  }
              else if(pwd=='5'){
   cout<<"15c";
  }
                else if(pwd=='6'){
   cout<<"16d";
  }
                  else if(pwd=='7'){
   cout<<"17e";
  }
                    else if(pwd=='8'){
   cout<<"18f";
  }
  else if(pwd=='9'){
   cout<<"19g";

User is offlineProfile CardPM
+Quote Post

no2pencil
RE: C To Pascal - Ummm How To Change It
14 Dec, 2007 - 07:23 AM
Post #2

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,444



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
1st off, you'll get a better responce if this was posted in C/C++.

code.gif

2nd, just a question of logic here. But what will your program do when it tries to read back in the encrypted text, & it comes across what was originally two q's & is now 11.
CODE

else if(pwd=='q'){
cout<<"1";
}

...

else if(pwd=='1'){
cout<<"11a";
}


Or how will it know the differnce between :

CODE

else if(pwd=='6'){
cout<<"16d";
}
and...
CODE

else if(pwd=='q'){
cout<<"1";
}
...
else if(pwd=='y'){
cout<<"6";
}
...
else if(pwd=='c'){
cout<<"d";
}

User is online!Profile CardPM
+Quote Post

born2c0de
RE: C To Pascal - Ummm How To Change It
14 Jan, 2008 - 10:47 PM
Post #3

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 3,906



Thanked: 34 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
Moved and changed title.
User is offlineProfile CardPM
+Quote Post

Tom9729
RE: C To Pascal - Ummm How To Change It
15 Jan, 2008 - 04:59 PM
Post #4

Debian guru
Group Icon

Joined: 30 Dec, 2007
Posts: 1,459



Thanked: 10 times
Dream Kudos: 325
My Contributions
You want to rewrite it in Pascal? blink.gif
User is online!Profile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 11:36PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month