Visual C++ :: Create A Function Using Rot To Encrypt Strings

Sep 30, 2013

I need to create a function using rot to encrypt certain strings the function begins like this

#include "encrypt.h"
std::string encrypt (std::string text, int rot) {
for (int i
and ends like this
return NULL;
}

dont need to write the string encrypted and dont need to crate a decrypt function.

View 4 Replies


ADVERTISEMENT

Visual C++ :: ImageList Create Function - Size Of Image

Jul 31, 2014

An ImageList_Create() function (see here) takes 2 parameters: cx and cy which are the width and height of each image.

Everything is good if I know in advance what size my images will have. But what if I don't?

Let's say I select 32x32 and my images are sized as 16x16. What will happen with the image list? Or my images are 48x48 and the image list should grow to accomodate the extra space. Since on Windows image list is just one big bitmap, will the height of the image list shrink/grow to 16/48 or not? Is there a way to test such behavior?

The problem I'm having is to check whether the actual images will be truncated when they are bigger that the image list initial size or not or whether I will see some extra space if the images are smaller.

The closest way I see is this function, but I am not sure its the right one to apply to the image list itself and not to the image inside the list.

How to test this properly and reliably on Windows XP+?

View 3 Replies View Related

Visual C++ :: Create Window Form Function Using MFC Or Win32 API?

Jan 7, 2013

My setup is as follows:

There is function written C++, that must be compiled to DLL. This DLL is linked to some CAD (computer aded design) tool, that has special interface for it.

I want to add to this function some GUI (graphical user interface). So the creation of a window is necessary.

I've tried already with Win32, but without success.

The problem is that CreateWindow function requires application instance handle, that is provided by Windows itself when window is created in "normal conditions".

View 14 Replies View Related

Visual C++ :: Window Created By Calling Create - DestroyWindow Function?

Jan 17, 2013

If a window is created by calling Create, the function DestroyWindow must be called to destroyed it at the end?

View 4 Replies View Related

C/C++ :: Segmentation Fault When Trying To Create AVL Tree Of Strings

Aug 7, 2014

I'm trying to create an avl tree where it's key value will be a string,however when I tried to convert the example in my book examples,which uses int,to char* the complier just shows up segmentation fault error This is the code I have:

#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <stdlib.h>
// An AVL tree node
struct node {
char *key;
struct node *left;
struct node *right;

[Code] .....

View 1 Replies View Related

C :: Create Function To Create A Dynamic Array That Fill With Randomly Generated Integers From 0 To 50

Oct 26, 2013

I have a struct called Array and I'm to create a function to create a dynamic array that's fill with randomly generated integers from 0 to 50 (inclusive) and a function to destroy the array for freeing its memory. Below the code that I have written so far.

Code:

* Struct */
typedef struct {int *pArray; //the dynamic array
int length; //the size of the dynamic array}Array;
/* Function to create a dynamic array */
Array *initializeArray (int length) {int i;
}

[code]....

View 7 Replies View Related

C/C++ :: How To Encrypt The Password To Be Inputted

Sep 14, 2014

#include<stdio.h>
#include<conio.h>
#include<string.h>
char str1[20], str2[20]="kent";
main() {
printf("Enter your Username: ");
scanf("%s",str1);

[Code] ....

View 1 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 :: Program Attempts To Encrypt A File Using XOR Operator?

Mar 18, 2013

My program attempts to encrypt a file using XOR operator. However, when I attempt to encrypt a file, it says "Error in reading file", (a printf function I set up if the program could not read the file, obviously). The problem is that I don't know what's causing this. Instead of encrypting the file, it just deletes all the characters in it, so I put in a fprintf to put place some text into the file. Here is the code:

Code:

#include<stdio.h>
#include<string.h>
int encryptd(FILE *);
int main(void)
{
FILE *fileptr;
int recode;
char fname[25];

[Code]...

View 7 Replies View Related

C :: Program In Which Computer Will Read Txt File And Encrypt It

Jan 1, 2014

I am writing a program in which the computer will read a txt file and encypt it. The encryption works fine, but the computer cannot read the file perfectly. If there's a newline, the scanning process stops. For example I have the following text in the txt file.

One two three four five
(newline) Six seven eight

The computer will stop reading after 'five'. I assume that is because I use fgets.

View 4 Replies View Related

C++ :: How To Make Own Binary Trees And Encrypt Messages

Jun 8, 2013

I'm having some trouble with my binary tree for school. It is a data structures class so we are working on learning how to make our own binary trees and encrypt messages. Everything so far is working, except for my delete node function. I'm trying to do it recursively. Parts of my code.

/******** Node *********/
struct node {
char data;
node* right;
node* left;
};
/******** Binary Tree Class *********/
class BinaryTree

[Code]...

View 5 Replies View Related

C++ :: Encrypt Char Array With Binary Data

Apr 14, 2013

I am trying to encrypt a char Array with binary data.

I think I understand the basic of Encryption / Decryption but I fail to see how to implement something.

I am trying to have a "key" that needs entered so the data can become readable executable. The program I am encrypting is a small console window with a message with the text "A secret message from your friend" (Not that it matters).

I have the binary data witch I can copy and what not. But how go about Encryption and then decrypt it and not destroying the data.

View 6 Replies View Related

C :: Encrypt Message Within BMP File - Incorrect Struct Size

Feb 9, 2015

I'd wrote a program to encrypt a message within a bmp file using my own structs and all for everything (yes, call me a ........head) The program works but for some weird ........ing reason I was forced to subtract 2 bytes from the header size to get the correct value. I've narrowed down the issue to my BmpFileHeader struct.

Here's a short program that demonstrates the issue:

Code:
#include <stdio.h>
#include <stdlib.h>

#define BYTE unsigned char
#define WORD unsigned short
#define DWORD unsigned long
#define LONG signed int

[Code] .....

Tried with both gcc and TinyCC and got the same result so it doesent seem to be a compiler bug. Microsoft's structures though are giving the correct size, even though they have the exact same definition.

Microsoft's defines:

Code:
// windef.h
typedef unsigned long DWORD;
typedef unsigned char BYTE;
typedef unsigned short WORD;

[Code] .....

View 5 Replies View Related

C++ :: Gather Input From User And Encrypt / Decrypt Those Characters?

Jan 5, 2015

I have got to create a program that will gather input from the user and then encrypt & decrypt those characters.

I'm not very confident at coding so I'm sure many parts of my code are written poorly and not following the best practice so I have written a simple version of an algorithm where the program simply adds/subtracts a value of 2 to/from the ASCII values but I have discovered the use of the rand() and srand functions but I'm unsure how to go about using them within both my encrypt and decrypt function as a single value (static variable?).

Here is my code in its entirety at the moment.

#include <iostream >
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cstring>
#include <fstream>
using namespace std;
char getMenuSelection (char m);
void encrypt (char key[]);
void decrypt (char code[]);

[code]....

This code currently doesn't execute due to ' undefined reference to 'encrypt(char*) '

Question

I am asking how to generate the random number and incorporate this into my encrypt and decrypt functions.

1. Would the use of a static or global variable make this work as is?

2. Would I need to create separate class files for both functions?

View 2 Replies View Related

Visual C++ :: Relationship Between Two Hex Strings?

Aug 19, 2013

I'm trying to make an application for ELM327 trouble code scanning device for my own educational purpose. Most of my app code is done. however, I am stuck at one point. And I need finding relationship between two hex strings.

I have logged some communication between ECU and a chinese code scanning device for carrying out car's fuel pressure test. However there is one message (that is sent from the user side) that keeps on changing each time which is dependent upon the last message received from the ECU which is also varying every time.

Code:
RECEIVED (07E8) SEND (07E0)
05 67 03 0C 17 6A 00 00 05 27 04 8F 45 37 00 00
05 67 03 0C DB 68 00 00 05 27 04 B0 70 6B 00 00
05 67 03 10 3B 87 00 00 05 27 04 3B BC 10 00 00

[code]....

as it can be seen 3 bytes are always changing with each test, both, in the message received from the ECU, and the one sent back to the ECU from the diagnostic scanner. Trying to figure out relationship between these two strings?

P.S: about 16 million combinations for 3 byte data are possible... there must be some link between them...

View 4 Replies View Related

Visual C++ :: Random Linked Strings

Feb 9, 2013

I want to make a funny and simple game in cmd with visual studio and here is my plan, here are the steps that I wanna accomplish:

The program asks the person for

1: 4 girl names
2: 4 boy names
3: What they do? (4 actions)
4: Where they do this? (4 locations)
5: Random linked things

And from here I want to randomly get 1 line of a random girl name + random boy name + random action + random place. and followed by the second, third, and fourth line of random chosen things.

Like this:
Girl 1 - Boy 3 - Action 2 - Location 4;
Girl 3 - Boy 4 - Action 4 - Location 1;
Girl 2 - Boy 1 - Action 3 - Location 3;
Girl 4 - Boy 2 - Action 1 - Location 2;

And it can get funny like: Amber and John are jumping from a bridge. a game where you can play with your friends and have fun.

Here is my code so far:

#include<iostream>
#include<string>
#include<ctime>
#include<cstdlib>
int main (void) {
using std::cin;
using std::cout;
using std::string;

[Code] ....

And from here I don't know what to do!!

View 3 Replies View Related

Visual C++ :: How To Access Argv Strings

Dec 22, 2012

I have:

int _tmain(int argc, char* argv[])
{
printf("drive name: %s
", argv[1]);

It displays only the first character of the first argument on the command line.

Yet the following works as expected:

static char* myArg[2] = {"first arg","second arg"};
printf("drive name: %s
", myArgv[1]);

That displays the entire string "second arg".

So what's wrong with my reference to argv[1]?

View 4 Replies View Related

C++ :: How To Use Strings In A Function

Mar 26, 2014

None of my string is coming out onto my output file..

void OutputHeading (ofstream& fout, string CLASS_EXERCISE,
string PROGRAMMERS_NAME);
void OutputDivider (ofstream& fout, int WIDTH,
char symbol);
void OpenFiles (ofstream& fout, ifstream& fin);

[Code] .....

View 1 Replies View Related

Visual C++ :: Compare Two Strings To See Difference In Int Form

Apr 2, 2013

I want to compare two string, and want to see differeince in int form. For example,

Code:
string first_string="0002AE1";
string second_string="0002AE2";

How can i calculate difference between two string? It is obvious difference between above two string is 1/-1, but difference would be 1.

View 2 Replies View Related

Visual C++ :: Saving Unicode Strings To Txt Files

Jan 20, 2014

In my project , we need to create an Array of Unicode Strings . The Array will contain 5000 Strings.

I need to write those strings to a text file which can be opened or edited with NotePad.

Normal _tfopen and fwrite are not able to create notepad compatible .txt file .. I mean the file I created is not readable with Notepad though file open mode is "w+t"

How can I save my unicode strings to a text file

View 6 Replies View Related

Visual C++ :: How To Do Binary Search On A Vector Of Strings

Sep 25, 2012

I'm trying to do a binary search on a vector of strings and keep getting this error. This is the PhoneEntry header file with the class declaration:

Code:
using namespace std;
#include<string>
#include<iostream>
#include<fstream>
#include<vector>
#include"phoneNumber.h"

[Code] .....

View 5 Replies View Related

C++ :: Pass Two Strings To A Function?

Dec 3, 2014

I am writing a driver program that will eventually need to pass two strings to a function I am writing in a separate file. I am reading data from a file that is formatted like this:

ac: and
amo: love
amor: love

[Code].....

Only a few of the words are actually being processed in the way I want. It appears that only words followed by a comma are processed correctly.

View 1 Replies View Related

Visual C++ :: Finding Items (strings) In Multiple Lists

Mar 12, 2013

Im working on a script compiler and i need to handle different types of data. Actually different categories of items.

Let's say i have two categories: cat's and bird's. They are different and stored in different lists. And let's say there is a simple command: GIVE_FOOD_TO(animal_type, food_type) Animal type here can be either from birds category or cat's category.

And also let's say user gives command: GIVE_FOOD_TO(cat1, fish)
and also for example: GIVE_FOOD_TO(bird1, birdfood)

Variable names could be anything, but im storing each variable name in std::map so later i can figure out with what animal current command is used.

When im parsing the script then i must know if user supplied either cat or bird. If i just would have cat's or bird's category then i would have only 2 lists and not a big problem to loop through either cats list or birds list and find out in what list the "cat1" is or in what particular list the "bird1" is. It would be in one or another.

But i have a lot of categories and looping through all of these lists (or std::maps) is slow and doesn't seem like a good. Just to find out in what list it's stored. I can't rely on variable names, they could be anything.

Big picture atm:

1) I have one BIG box which stores all of the categories

2) When i need to find out to which category the variable (animal_type) point's to i must get it quickly, dunno, std::map in std::map or something?

What i need basically is: I have different lists (each one is just a category for either birds or cats in this example) And when i have variable name, i must find out quickly in what particular category this item is stored. So i can work with it.

View 4 Replies View Related

Visual C++ :: Procedure To Compare 2 Strings With Specific Criteria?

Jul 10, 2013

Procedure to Compare 2 Strings with the following criteria

coding of the following function -

I have absolutely no clue where to start -

Given the following sets of numbers -

1154 1179 2154 2554 2484 2144 4515 1144 1517 4815 1481

Given the Index number of 1154

I want to search the numbers for the Index number of 1154

The search will return a True if I can find 3 or 4 same digits between the Index number and the 8 numbers

The search also have the following criteria -

meaning that -

1154 when compared to 1154 == true
1154 when compared to 1179 == false
1154 when compared to 2154 == true
1154 when compared to 2554 == false
1154 when compared to 2484 == false
1154 when compared to 2144 == false
1154 when compared to 4515 == true
1154 when compared to 1144 == true
1154 when compared to 1517 == true
1154 when compared to 4815 == true
1154 when compared to 1481 == true

the index number can also be of type - 1234, 1123, 1112, 1111

View 14 Replies View Related

Visual C++ :: Program That Take Strings From File And Push It Into Stack

Sep 29, 2013

How to write a programme that take strings from file and push it into the stack with number of each sting string before it and later clean the stack?

View 6 Replies View Related

C :: 2D Array With 108 Strings - Shuffle Function?

Sep 7, 2013

I have a 2D array with 108 strings. How do I shuffle it correctly?

Code:
void Shuffle( char dest[208][13] )
{
// Initialize variables
char temp[13];

// Loop and shuffle(swap array values)

[Code] .....

The program force closes.

View 6 Replies View Related







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