ok, here is the stupid code:
Code:
#include <stdio.h>
#include <windows.h>
#include <iostream>
using namespace std;
void sentencecall();
void clrscr(void);
int main(){
int j, A;
char x[256];
char str[51];
sentencecall();
if(strlen(x)>50){
cout << "The Sentence was too long\n\nRESTARTING...." << endl;
clrscr();
main();
}
else {
for(j = 0; j < strlen(x);j++){
str[j] = x[j];
}
}
for(A = 0; A < str[j]; A++){
if(str[A]==32){str[A]=0;}
if(str[A]==97){str[A]=01;}
if(str[A]==98){str[A]=02;}
if(str[A]==99){str[A]=03;}
if(str[A]==100){str[A]=04;}
if(str[A]==101){str[A]=05;}
if(str[A]==102){str[A]=06;}
if(str[A]==103){str[A]=07;}
if(str[A]==104){str[A]=27;}
if(str[A]==105){str[A]=28;}
if(str[A]==106){str[A]=10;}
if(str[A]==107){str[A]=11;}
if(str[A]==108){str[A]=12;}
if(str[A]==109){str[A]=13;}
if(str[A]==110){str[A]=14;}
if(str[A]==111){str[A]=15;}
if(str[A]==112){str[A]=16;}
if(str[A]==113){str[A]=17;}
if(str[A]==114){str[A]=18;}
if(str[A]==115){str[A]=19;}
if(str[A]==116){str[A]=20;}
if(str[A]==117){str[A]=21;}
if(str[A]==118){str[A]=22;}
if(str[A]==119){str[A]=23;}
if(str[A]==120){str[A]=24;}
if(str[A]==121){str[A]=25;}
if(str[A]==122){str[A]=26;}
cout<< str[A] <<flush;
}
cout<<"\n\n";
system("pause");
}
void sentencecall(){
cout << "Enter the sentence you wish to have encrypted." << endl;
char x[256];
char str[51];
cin >> x;
cout << "\n\n";
return;
}
void clrscr(void)
{
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole, TEXT(' '),
dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes,
dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hConsole, coordScreen);
}
it will not display the message if more than 50 characters are inputed, it will not display this: "cout<< str[A] <<flush;" whne i want it to....i think everything is rgiht, but evidently not....anyone up to the challenge?