C/C++ :: Caesar Cipher Not Decrypting Text Right

Mar 29, 2015

I have managed to print out the encrypted text from the console, however it doesnt decrypt correctly and isn't returning the correct key. I can't seem to find the error that is causing the decrypted text from printing correctly. When I try to decrypt the text it changes it completely as well.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "rotUtils.h"
bool solved( char decodearr[], char dictarr[][30], int size1, int size2){
char* compared;
bool result = false;
for(int j = 0; j < size2; j++){

[code]....

View 3 Replies


ADVERTISEMENT

C++ :: Caesar Cipher Reading Text

Aug 1, 2013

I get the error of not declaring "text" "exit" but I how do I declared those variables, even if they cause problem to file... How can I output the decipher file in a new text...?

#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <fstream>
#include <math.h>

[Code] ....

View 6 Replies View Related

C++ :: Deciphering Unknown Shifted Caesar Cipher Text File

May 25, 2014

The assignment is to open an encrypted file, count the occurrence of each alphabetic character in the file. find the highest occurring letter and use that to find the shift, then apply the sift to the file in order to decipher and then print out the deciphered txt.

#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main(){
string word;
ifstream txt;
int arr[26] = { 0 };

[Code] ....

View 5 Replies View Related

C++ :: Caesar Cipher With 2D Array

Dec 11, 2013

I am making a simple caesar cypher with a 2D array. I have to make a function for the key shift so

key=5
ABCDEFGHIJKLMNOPQRSTUVWXYZ
FGHJKL...ABCDE

Function Name: Key_Array
This function uses the random key value to make a key array
Passed: value = random key value
Returns: alphabet = rearranged alphabet

[Code] .....

I am having trouble outputting the rearranged alphabet to the screen also.

View 1 Replies View Related

C :: Write A Code About Caesar Cipher Shift And Using ASCII With It

Dec 5, 2014

I am struggling to write a code about caesar cipher shift and using ascii code with it. For example letter b should be replaced with the letter c and using the ascii code it should be from 98 to 99 and so on..

View 1 Replies View Related

C/C++ :: Decrypting From Text File And Saving To New One

Apr 24, 2015

I'm very new to c and c++ and am currently working on a Caesar cipher that grabs encrypted text from a txt file and decrypts it onto a new txt file. My code builds fine in CodeBlocks and when I run it, there is a new txt file created but it stays blank.

#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <cstdlib>
using namespace std ;
int main(int argc, char *argv[]){

[Code] ....

View 7 Replies View Related

C++ ::  Decrypting And Encrypting Following A Certain Protocol?

Mar 26, 2014

I have a certain method of encrypting text. You get the first character of the word. For example in the word "hacker", you get 'h', and then you get the last character 'r'. The encrypted word until now is "hr". Then we get the same word with the 'h' and 'r' removed, now it's "acke". I do the same thing and get the first character 'a' and the last one 'e' and them to the encrypted word: it is now "hrae".

The left letters of the word are "ck", again we do the same thing and take the first character 'c' and the last character 'k' and and add them to the new encrypted word so it is "hraeck". The above word has an even number of characters and at the end had 2 characters left 'c' and 'k',first and last, in some cases of words with an odd number of characters, only one character is left! I'm completely lost on how to encrypt and decrypt this.

View 4 Replies View Related

C++ :: Encrypting / Decrypting Strings

Jul 16, 2013

I have a simple decryption program but I cant get it to encrypt/decrypt text read from the keyboard using getline (), did i declare wrong?

#include <iostream>
#include <string>
using namespace std;
char text[ ]

(here I have my void decrypt/encrypt functions)

int main () {
cout <<''Enter text to encrypt''<<endl;
getline(cin,text);

View 3 Replies View Related

C :: Decrypting / Extracting Custom File Formats

Sep 25, 2014

So this may be against the rules, not sure, grey area probably? However I just bought the PC game Oil Rush, and was having a look at how the assets are packed. As with most games the textures, scripts, sounds and audio are all free to access.

However the game data such as maps, models and other, are packed into UNG files, i.e a custom encrypted file format, which probably is also compressed. So I googled for an unpacker/extracter and found one which also comes with the C source. You can download here. [URL] ....

So I am trying to figure out how these authors work out this file format, from the source we have,

Code:
static const u8 unigine_mask[] = "xffx7fx3fx1fx0fx07x03x01";
u32 unigine_key = 0xa13cdbde;

Looks like a password of sorts. You then have to work out the complete understanding of the file formats, headers, blocks etc.. How is this done...

View 4 Replies View Related

C++ :: How To Encrypt TXT Document Using Caesar Encryption

Mar 1, 2013

so i need to encrypt a txt document using Caesar encryption. however i don't know how to open a txt and shift the keys into a new txt. the program has to ask the user for the number it should shift. Using arrays, if else. i also need to make a menu so i am using switch.

View 4 Replies View Related

C/C++ :: Vigenere Cipher Not Decoding

Mar 11, 2015

I was assigned to make a vigenere cipher using the function void vegenere(char* to_encrypt, char* key, char* encrypted) I got it to work for the encryption but i have to be able to decrypt the phrase too. I was assigned to write in a flag which indicated encryption or decryption. I tried to implement this but now it wont decrypt and i dont know why, all it does is put the same copy of decryption (which is really encrypted) multiple times until it crashes.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
void decrypt(char *to_encrypt, char *key);
enum flag{encryption = 1, decryption = -1};

[Code] ....

Ok i found my dumb error of putting decrypt on an infinite loop which i fixed by putting it into the if statement after the encryption output. However now it says that the encrypted and decrypted outputs are identical without decrypting the ciphertext

View 5 Replies View Related

C++ :: Decode / Code A Simple Cipher

Mar 1, 2013

So I am trying to make a simple cipher but can't see a pattern between the letters.

Convert:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
To:
E I L Q A G F R B N T C P J Z M D H X K Y W V S U O

View 1 Replies View Related

C++ :: Error Handling - Enigma Cipher Simulator

Jan 4, 2014

I finished my Enigma cipher simulator...how should I write the error handling code? Should I throw an exception in main, or in the Enigma ctor and Encrypt() fn when the user enters a non-alphanumeric character?

Rotor.hpp

Code:
#ifndef ROTOR_HPP
#define ROTOR_HPP
class Rotor {
public:
Rotor(char pos='A');
Rotor(const Rotor & rhs);
Rotor& operator=(const Rotor& rhs);

[Code] ....

Output

Code:
Enter rotor settings:
ABCDEFGHIJ
Enter cleartext:
HELLO WORLD
Ciphertext:
0O258 SGY5V

View 3 Replies View Related

C/C++ :: Program That Opens Text File And Checks Usernames Listed In Text Files?

Jun 5, 2014

I want to make a program that opens a text file and checks the usernames listed in the text files to see if the names are registered on a site such as twitter. How easy would this be to make, what things would I need to know?

View 4 Replies View Related

C++ :: Getline - Get Text File And Read Only First 100 Lines Of Text Content

May 31, 2013

I am trying to get text file and read only first 100 lines of the text content using c/c++. how can i do it?

is it something like string line;
getline(stream,line);

??

View 7 Replies View Related

C++ :: Filter Text Enclosed In Specific Tags From Text File?

Aug 30, 2013

I have a huge text file in following format:

{Bunch of text
.
.
}

[Code].....

I want to extract Text1, Text2, Text3, Text4,..., Text600 in the output file. How can i achieve this?

/* BTW, I am not getting my homework done here. I am an ex-programmer, who has now moved to marketing for some time now, and today, I encountered this problem, which I believe can be solved easily through programming. */

View 3 Replies View Related

C/C++ :: Delete Text From File And Than Shift The Rest Of The Text Upward

Aug 31, 2014

i want to create 100 gmail accounts instantaneously....what i want from you guys is i have written a program that create a text file i want that once i give the program the imput of 1 it should delete the first 3 lines from the file i.e. the first account details coz that is already been created and shift the rest of it 3 lines upwards after that i'll write a javascript that will automatically fill and create the accounts with those names in web browser.....my lil program is here:

#‎include <stdio.h>
#include <conio.h>
main()

[Code]....

View 1 Replies View Related

C++ :: Program To Convert Normal Text To Mobile Text

Mar 26, 2013

Program that reads in a normal text file and converts it into mobile phone text. that is if the word is 3 characters or less then ther is no changes to the word and if the word is four or more letters then remove all the vowels from the word except for vowels that are capitals.

View 5 Replies View Related

C++ :: Extracting Specific Lines Of Text From A Text File

Aug 2, 2014

I have a text file called (Test.txt) with the following text:

This is line one
This is line two
This is line three

How do I go about writing a program that will print a line of text (e.g. "This in line two" on the console screen?

All I can seem to do is display the entire text file.

View 6 Replies View Related

C# :: How To Highlight / Select Text In WPF Text Box Without Focus

Aug 23, 2012

I want to highlight selected text in a wpf textbox while the textbox is not focused. In my application, my textbox never gets focus, and every key input is done manually. I was wondering if there is a way to highlight the selected text when the textbox is not focused?

View 1 Replies View Related

C++ :: Store Text To Array Until Text Is Over

Sep 10, 2014

This is part of my code. what i wanna know is if there is a way to fill this array until the text is over instead of having to set the number of strings in the file (20). And then store that number into a variable.

int main() {
//array:
string words[20];

//file to open:
ifstream file("test.txt");

[Code] .....

View 1 Replies View Related

C :: Original Text File / Generate Another File With Text Content In Upper Case

Nov 29, 2014

Code software that, from an original text file, generate another file with the text content in upper case.For exemple:

entrence:

luke
tom
alex

outings:

LUKE
TOM
ALEX

My code so far:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
}

[code]....

View 2 Replies View Related

C Sharp :: How To Get Text From Node In XML File That Contains Text And Child Node

May 21, 2013

I have a very big xml file. I read it using by xmlReader. I have problem when i reach to next line:

<title>Abasia<nemod>(-astasia) (hysterical)</nemod></title>

How I can read all that content. I have to have next string at the end: "Abasia (-astasia) (hysterical)".

I tried to use ReadElementContentAsString() for all elements, but elements like this has exception, because it has child element.

View 1 Replies View Related

C :: How To Print Text

Sep 6, 2014

I found it incredible that I could not found any working example of simple printing text while I was looking on google.

Somewhere I read I should include (I am not sure if I remember the name right but code::blocks on Windows did not find the header)

Code: #include <stdiostream.h>

so I am trying

Code: #include <stdio.h> and cout << "test"; (error: cout undeclared)

or

Code: #include <stdio.h> and std::cout << "test"; also I tried print("test");

as noted somewhere on Answers. Did not work (error: undefined reference print).

Last try I even got most of links in French. So I hope you'll give me the correct answer. Edit: I found it. I used puts()

View 6 Replies View Related

C++ :: Converting Text To Hex

Jan 3, 2013

From my tests I found the problem to be somewhere in the Mantissa part that converts it to binary.

bool xsDLL GetHexFromSF_IEEE754( void* to, Text from, ui08 tSize ) {
from.UpperCase();
int db = 0, dB = 0, dBEnd = tSize, dBLast = ( tSize - 1u ), dbEnd = dBEnd * 8;
ui08 *data = reinterpret_cast< ui08* >( to );
for ( ; dB >= 0; --dB )
data[ dB ] = 0u;

[Code] ....

Adjustments made, still having problems though. After finding a more useful resource [URL] ..... I got the function looking more like it should but am still having problems...

View 1 Replies View Related

C++ :: Getting Max / Min From A Text File?

Feb 27, 2013

How do I get a max or a min in my code using numbers from a text file?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved