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


ADVERTISEMENT

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++ :: 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/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 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++ :: 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/C++ :: Drawing A Rectangle Using ASCII Code And For Loops?

Apr 24, 2015

For a Texas holdem' project I need to be able to draw out rectangles using ASCII codes and for loops. I started the code

#include <iostream>
#include <string>
#include <Windows.h>

[Code].....

View 6 Replies View Related

C/C++ :: Write A Code That Can Crack The Sha256?

Mar 28, 2015

is it possible to write a code that can crack the sha256 hash when you know the form of password? for example the password form is *-********** which is 12-13 characters long and the first char is one number from 1 to 25, second one is hyphen and in each char from the third one to the end, you can put a...z, A...Z and 0...9 and after guessing each pass, the code convert the pass to sha256 and see whether the result hash is equal to our hash or not and then print the correct pass. I know all possible numbers is a big number ((26+26+10)^10) but I want to know that: 1- Is it possible to write such code? 2-if yes, is it possible to run whole code in less than one day(because I think it takes a lot of time to complete the whole code)? 3-Since I can't ask you to write a code for me, how and where can I ask for this code? 4-if no, is it possible to write such code in other programming languages?

View 2 Replies View Related

C :: Write A Code To Calculate Minimum Number

May 24, 2014

I'm trying to write a code to calculate the minimum number of coins needed to cover a change. It works fine but i want to display a message telling the user to try again if they type something that's not a number or a negative number. But it's not working. When i type a negative number, the program runs normally and displays a negative value of coins instead of showing the message. And when i type something that's not a number, the program just keeps showing a lot of zeros nonstop. And when i try to compile it with 'unsigned float' instead of just 'float' i get errors.

Code:

#include <stdio.h>
int main()
{
unsigned int coins;
float change;
unsigned int n25, n10, n5, n1;
unsigned int r25, r10, r5;
}

[code]....

View 7 Replies View Related

C :: Write A Code To Find All The Prime Numbers Before A User Entered Number

Apr 9, 2014

I am trying to write code to find all the prime numbers before a user entered number. I started with a working program and when I tried to create a function, it got all messed up.

Code:

#include <stdio.h>
int is_prime( int num );
int get_positive_integer(void);
int main( ) {
int upper; /* upper limit to check */
int num; /* current number to check */
int isprime;
/* used to flag if number is prime or not */

[Code]...

It says the error is on line 23

View 6 Replies View Related

C++ :: Write A Source Code That Find Smallest / Largest And Average Of Numbers From Array

May 13, 2014

im trying to write a source code that find the smallest, largest and average of numbers in array. the code runs fine, but it is not giving the highest number and the the average should include only four number excluding highest and smallest number from the array.

void OlympicJudging() // Olympic Judging {
int numbers [6];
double average, sum = 0;
int temp;
for(int i = 0; i < 6; i++){
cout << "Please type a value for scores: ";
cin >> numbers[i];

[Code]...

View 5 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++ :: 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 :: How To Shift Strings Down In Array

Feb 23, 2013

I am having this problem were the user types in a substring to search in the main string and replace it with another string

for example:

string: hello
sub string: el
replace: i

should print this: hillo

I tried using some string functions but I am having problems with that.

View 7 Replies View Related

C++ :: Circular Right Shift A Cstring

Jan 29, 2013

I need to circular right shift a cstring in C++

Let's say I have unsigned char test[10] = "HELLO!!!"; How would I go about circularly shifting this to the right? Inline assembly instructions would be ok too

View 6 Replies View Related

C++ :: Right Shift A PackBCD String

Feb 10, 2015

I have this BCD string: 890123...78FFF and need to right shift by say 3 nibbles, resulting in: FFF890123...78
length is fixed, number of 'f' nibbles are varying.

View 3 Replies View Related

C Sharp :: How To Shift From One Tab To Other Programmatically

Apr 24, 2012

when we are trying to shift one tab to other one event should occur, can any one tell what is the event,how and where we have to write the event? give example. if he successfully login in first tab only then second tab will open,if he doesnt login in first and tries to open the second tab message should appear...

View 1 Replies View Related

C :: How To Determine Whether A Logical Or Arithmetic Shift Is Performed

May 26, 2013

If input value was shifted to the right on bit level. How can I determine whether a logical or arithmetic shift is performed.

Code:
#include <stdio.h>
#include <stdlib.h>
void main ()

[Code]......

View 6 Replies View Related

C++ :: Bitwise Shift Operator - Size Of Integer

Feb 24, 2012

I have a doubt in Left Shift Operator

int i = 1;
i <<= (sizeof (int) *8);
cout << i;

It prints 1.

Doubt:

i has been initialized to 1.

And while moving the bits till the size of the integer, it fills the LSB with 0's and as 1 crosses the limit of integer, i was expecting the output to be 0.

How and Why it is 1?

View 2 Replies View Related

C :: How To Show All The Bits Of A Number Using Bitwise Shift Operator

Mar 30, 2013

how to show all the bits of a number using bitwise shift operator....and hence represent the number in 2's complement representation

View 1 Replies View Related

Visual C++ :: SDI App - Constraint Mouse To Move Only Horizontal Direction If Shift Key Pressed

Apr 23, 2015

In a SDI app, I constraint the mouse to move only an horizontal direction, if "Shift" key is pressed ... here is the code:

Code:
void CTestMouseView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) {
// TODO: Add your message handler code here and/or call default
if(GetKeyState(VK_SHIFT) < 0) {
CRect rect;
GetWindowRect(&rect);
GetCursorPos(&m_point);

[Code] ....

Nothing complicated, and it works well ... except one thing: when I press the shift key and the mouse is moving by SetCursorPos, is moving pretty slow ... why ? I can not figure out why ! For testing, I attached the test project ...

View 13 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++ :: How To Use ASCII Art In C

Feb 26, 2014

How do I print this without generating errors?

Code:

printf(" ||====================================================================||
");
printf(" ||//$///////////////////////////////$||
");
printf(" ||(100)==================| RESERVE BANK OF INDIA|================(100)||
");
printf(" ||$// ~ '------========--------' $//||

[code].....

View 8 Replies View Related

C++ :: Convert Hex To ASCII

May 7, 2013

I want to convert Hex:390041 to ascii "90A",

39: 9
00: 0 -->Null
41: A

i am getting only "9" in the bytearray,i know 0 is terminating the array

unsigned int bytes[3];
int j=0,counter=0;
char c[2];

[Code]....

View 1 Replies View Related

C++ :: Subtracting ASCII Hex Value In 64 Bit Hex Value

Mar 31, 2015

I have some ascii characters in a char variable.ex - char buf[100]="ab*(z&";

So each of the char in that char array will have some hex value.ex- *'s hex value is '2a'.

And I have a long long int variable in which there is a 64 bit hex value.

ex- long long int k=0x0000888888888888;

Now i want to subtract the char buff's hex value in k. How to accomplish it.

That is 0x0000888888888888
- 0x000061622a287a26
= 0x000027265e600e62 (final result in a buffer or a long variable is okay)

Later i want to reverse the result as 26e006e56272.It should be stored in a variable such that i should be able to access each byte from it(ex- '72'(last 2 hex digits))

View 1 Replies View Related







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