jpass, on 25 August 2011 - 11:23 PM, said:
do I have to use each one for each instance?
You need to use those three lines to replace each occurrence of system("PAUSE").
Is that your question?




Posted 25 August 2011 - 06:00 AM
//
// Encryption Program
//
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;
int main()
{
//This program changes text into various levels of
//encryption based on the user's specification.
//Before beginning user must input proper username
//and password.
//First get username and password
string password;
password="elevenfingers"; //Create the ability to use
//several different usernames and
//passwords
string username;
username="jpass"; //Username is first initial & first
//four of last name
string userinput;
do
{
cout<<"Enter username:";
cin>>userinput;
if(userinput==username)
{
cout<<endl<<"Enter password:";
cin>>password;
}
else
{
system("CLS");
cout<<"Invalid Username.\n"<<endl;
system("PAUSE");
return 0;
}
}
while(userinput!=username);
if(password!="elevenfingers")
{
system("CLS");
cout<<endl<<"Invalid Password.\n\nACCESS DENIED.\n"<<endl;
cin.clear;
cin.ignore;
cin.get;
return 0;
}
else
{
system("CLS");
cout<<endl<<"Welcome Mr. Pxxxxxxxxx\n\n"<<endl; //Call up different welcome
//message based on
//username/password
cin.clear;
cin.ignore;
cin.get;
return 0;
}
//Now begin encryption program
cin.clear;
cin.ignore;
cin.get;
return 0;
}
Posted 25 August 2011 - 06:40 AM
Quote
cin.clear(); cin.ignore(); cin.get();
Posted 25 August 2011 - 07:24 AM
Quote
cin.clear(); cin.ignore(); cin.get();
Posted 25 August 2011 - 01:30 PM
janotte, on 25 August 2011 - 08:33 AM, said:
Posted 10 September 2011 - 11:14 AM
switch (userChoice)
{
case 1:
//Allow user to enter plaintext.
char ptext;
system ("CLS");
std::cout << "Enter your text.\n\n";
std::cin >> ptext;
seesir();
break;
void seesir()
{
char *ptext; // ciphertext
int shift = -13; // ciphershift
for( char *letter = ptext; letter; ++letter )
{
bool isCaps = ( *letter >= 'A' ) && ( *letter <= 'Z' );
if( isCaps )
*letter -= 'A'-'a';
letter -= 'a';
letter = ( letter + shift + 26 ) % 26;
letter += 'a';
if( isCaps )
letter += 'A'-'a';
}
}
Posted 10 September 2011 - 11:36 AM
Posted 11 September 2011 - 05:05 AM
char ptext; // Room for one character
system ("CLS");
std::cout << "Enter your text.\n\n";
std::cin >> ptext;
seesir();
Posted 11 September 2011 - 12:59 PM
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
void seeSir()
{
int shift; //number of characters to shift
shift == 13;
char ptext[800]; //plain text
char ntext[800]; //new text
std::cout << "Enter your text.\n\n";
std::cin >> ptext;
//Change uppercase letters to lowercase
for (char c=0; c<800; c++)
{
if ( ptext[c] < 91 && ptext[c] > 64)
ptext[c] = ptext[c] + 32;
}
//Output the new text
ntext = ptext[c] + shift; //I added this after getting an "Undeclared" error.
std::cout << "\n";
std::cout << "Your enciphered text is:\n\n" << ntext + shift;
}
Posted 11 September 2011 - 02:06 PM
Quote
for (char c=0; c<800; c++)
{
if ( ptext[c] < 91 && ptext[c] > 64)
ptext[c] = ptext[c] + 32;
}
//Output the new text
ntext = ptext[c] + shift;
This post has been edited by jimblumberg: 11 September 2011 - 02:07 PM
Posted 11 September 2011 - 02:20 PM
Posted 11 September 2011 - 02:34 PM
Quote
Posted 11 September 2011 - 02:36 PM
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
void seeSir()
{
int shift; //number of characters to shift
shift = 13;
char ptext[800]; //plain text
char ntext[800]; //new text
int c=0;
for (int c=0; c<800; c++)
{
if ( ptext[c] < 91 && ptext[c] > 64)
ptext[c] = ptext[c] + 32;
}
std::cout << "Enter your text.\n\n";
std::cin >> ptext;
//Output the new text
ntext = ptext[c] + shift; //I added this after getting an "Undeclared" error.
std::cout << "\n";
std::cout << "Your enciphered text is:\n\n" << ntext + shift;
}
This post has been edited by jpass: 11 September 2011 - 02:36 PM
Posted 11 September 2011 - 03:12 PM
Quote
ntext = ptext[c] + shift;
