NathanOliver 429 Veteran Poster Featured Poster

well from what i can see you have an hEdit in the SaveTextFileFromListBox function but you are not passing it into your DoFileSave function so the program doesn't know what it is i.e. not defined. try passing it into the function and see what happens

NathanOliver 429 Veteran Poster Featured Poster

in every header file it is a good idea to use inclusion guards. so to stop it from getting defined all the time just put

#ifndef RANDOMC_H
#define RANDOMC_H
//  all the code in randomc.h goes here
#endif

this will make sure that the file is only included the first time and every other time #include "randomc.h" is encountered the compiler will skip that file because it is already defined. I've found this makes things easier down the road and saves some debugging time.

NathanOliver 429 Veteran Poster Featured Poster

well a multidimensional array has a max that is equal to the max of each dimension multiplied together. so if your array is array[10][5][20] then you would do 10*5*20 to get the max which would be 10000. this works no matter how many dimensions you have. so in your program you would set maxN to the max of each dimension in your array times each other.

NathanOliver 429 Veteran Poster Featured Poster

thank you all for your answers i just wasn't sure what type of speed i should be looking for.

NathanOliver 429 Veteran Poster Featured Poster

use a cout statement asking the user what type of severity they want like

//...
std::string choice;
cout << "Please enter the severity you want.\n";
cout << "Your choices are: warning, success, information, and error: ";
cin >> choice
//...
}
NathanOliver 429 Veteran Poster Featured Poster

with the key used i use 4 different techniques to generate the key for the encryption. I use the password size, the characters in the password and the size of the text plus random characters in the text. I'm pretty sure that with this the only way to decrypt the text is to have the exact password and text. i read the entire text at one time and then randomly pad the text with characters to make it an even size

NathanOliver 429 Veteran Poster Featured Poster

the cipher is a combination of a block and stream cipher. i did the math and it comes out to be a 256 bit cipher and i am working on upgrading it to be have a 512 bit method as well. my general purpose for this for the transmission of documents over networks where there is a possibility where the data might cross an unsecured connection or where there is a possibility that the route the data will take will go through a country/server where it might be copied.

NathanOliver 429 Veteran Poster Featured Poster

Hi i am building a program that will take the text of a supplied file and encrypt using a password then save the encrypted text in another file. To decrypt the file you must provide the same password used to create the file. the program encrypts the text at a rate of about 5000 characters per second on a 500mhz Intel Pentium 3 running windows xp pro. I as wondering if that was an okay speed or if it is really slow. i have included a sample text document and the text file i get after i encrypt the text. Any info would be greatly appreciated.

NathanOliver 429 Veteran Poster Featured Poster

when you use << it looks for a method to ouput the data. since you are trying to output the class the compiler looks for a method to ouput but since yo dont have one you are getting this error. you need to overload the << operator so it displays the data of the class.

// class functions declerations
friend ostream & operator <<(ostream & out, IntArray & array);
// more class functions
//...
//class definitions
ostream & IntArray::operator <<(ostream & out, IntArray & array)
{
 for (int i = 0; i < numElements; i++)
 {
   cout << data[numElements] << "\n";
 }
 return out;
}

not only will this ouput the data of the class but since it returns an ostream reference you can write statements like cout << a << endl << b << endl << c << endl; otherwise you would have to output each class one at a time

NathanOliver 429 Veteran Poster Featured Poster

i noticed in your code that you posted that in basetsd.h int the #if statement #if ( 501 < __midl ) there are typedef's for a LONG_PTR and a ULONG_PTR which might be giving you the error since you are typedefing them again in your xvt_type.h file

NathanOliver 429 Veteran Poster Featured Poster

it might be windows specific but I'm not sure. i am using Microsoft visual c++ 6.0 professional and found it in my msdn one day when trying to find an answer to this specific problem for use with a very basic login screen and it didn't care about case sensitivity in the passwords and user names. all of the code that i have made so far has been on windows machines so i couldn't tell you if it is portable to other OS's. i have include my string.h file so that you can see the function prototype. the function is marked with a comment for you.

NathanOliver 429 Veteran Poster Featured Poster

there is a function in the <string> header file called _stricmp that will convert all the characters to there lowercase. the function is defined as

int _stricmp( const char *string1, const char *string2 );

this function will return 0 if the strings are equal. less than 0 and greater than zero returns mean they do not match. to use this i would write

#include <string>
#include <iostream>

using namespace std;

int main()
{
string string1 = "abcd";
string string2 = "ABCD";
int equal;
equal = _stricmp(string1.c_str(), string2.c_str());
// using the c_str function here to pass the char array to the
 //function because it does not take in a string but a char
if (equal == 0)
cout << "the strings are equal"
else
cout << "the strings are not equal"
return 0;
}

hope this helps you out

Dave Sinkula commented: Bad advice in a number of ways. -4
NathanOliver 429 Veteran Poster Featured Poster

have you tried adding a cout statement before you assign the value to the array to make sure you are getting an assignment.

f_in.read((char *)&speech, 2);
cout << value[i] << "\t";  // show the value before assignment
value[i] = speech;
cout << value[i] << std::endl;
f_out.write((char *)&speech, 2);
NathanOliver 429 Veteran Poster Featured Poster

are you getting the same number for every value?
are you sure that the size of each element is 2?

NathanOliver 429 Veteran Poster Featured Poster

the problem is that when you say temp = 3 + (text[i] - '0'); in your for loop you are constantly setting the string to just one character. to build the string i would either use temp += 3 + (text[i] - '0'); or temp.append(3 + (text[i] - '0')); that will at least get the entire string

NathanOliver 429 Veteran Poster Featured Poster

if you want to assign the last name to be equal to DELETED then you would want to have

List[K].setLast("DELETED");
NathanOliver 429 Veteran Poster Featured Poster

i would use the getline function and make the delimiter the space between each element then store them in separate arrays

NathanOliver 429 Veteran Poster Featured Poster

sorry i meant to do this

char ch;
ifstream fin(*infile);while (!fin.eof()){for (int count=0; count < 4; count++) {  for (i = 0; i < SIZE - 1; i++){fin >> inchar//...ifstream fin(*infile);
while (!fin.eof())
{
for (int count=0; count < 4; count++) 
{  
for (i = 0; i < SIZE - 1; i++)
{
fin.get(ch);
//...

I'm pretty sure that will work.

NathanOliver 429 Veteran Poster Featured Poster

what i would do is get rid of the second newline in DataBase << Password << "\n\n"; and have DataBase << Password << "\n"; with one newline in the join function so that file goes
username
password
username
password
...

then in login you could use a while loop and just skip every other line of input from the file because thats is the password and you are just checking the username. otherwise you would want to retrieve the username and password. if you just want the username you could do this

ifstream DataBase("DataBase.txt");
int counter = 1;
cout << "Welcome Member, Please Enter Your Username and Password:\n\n";
cout << "Username: ";
cin >> User;
while (!DataBase.eof())
{
if ((counter % 2) == 0) // this will get the next line in the file then skip
{
   DataBase >> Username;
   continue;
}
DataBase >> Username;
if (Username == User)
//...
NathanOliver 429 Veteran Poster Featured Poster

well I'm not to sure about FILE but i know that if you do this you can loop through the file until the end.

ifstream fin(*infile);
while (!fin.eof())
{
for (int count=0; count < 4; count++) 
{  
for (i = 0; i < SIZE - 1; i++)
{
fin >> inchar
//...
NathanOliver 429 Veteran Poster Featured Poster

in case 1 you should have the price of the tickets added to the total so that way evertime someone bys a ticket the total is updated.

NathanOliver 429 Veteran Poster Featured Poster

no prob happy to help if you have any other errors or logic faults let me know nd ill happy to help.

NathanOliver 429 Veteran Poster Featured Poster

the this pointer is the holder of what class is holding the function. that way you can call other function within a function using this->

NathanOliver 429 Veteran Poster Featured Poster

why are using a template for this application? you could just pass the values into the constructor in the matrix class and have a resize function built in if you need to change it. templates are used to make functions or classes that can have or use different types and are used instead of having to write a function or class for each different type.

NathanOliver 429 Veteran Poster Featured Poster

on line 47 you have

temp.estimatedTime = h.estimatedTime + h.estimatedTime;

all this is doing is adding the term h.estimatedTime to itself effectively doubling it. if you want to add the first and second terms you can do

temp.estimatedTime = this->estimatedTime + h.estimatedTime;

this will add both terms together if the data is public. if you want to keep the data private i would suggest writing some accessor functions like int GetEstimatedTime() {return estimatedTime } so you can get the private data.

NathanOliver 429 Veteran Poster Featured Poster

when you declare the class you can do this

template<typename T, typename T>
class matrix
{
//...
// or
template <typename T, typename C>
class matrix
{
//...

the first example both numbers passed will be the same type that you chose the second example the first and second term can be different ie. <int, double> <short, long> etc.

NathanOliver 429 Veteran Poster Featured Poster

if you mean that you want to round the number to a specific number of decimal places you might want to make a char array and use _gcvt() to store in the number of digits you want. for your example if you want pi to 5 places you could do this.

const double fullPi=3.141592653589793;
char * pi = new char[8];
_gcvt(fullPi, 8, pi);

_gcvt() takes in a double and outputs the number of digits specified in the second term then it outputs the string into the char[] in the third term. for this you need to have an array that is big enough to hold the digits before the decimal place the decimal itself the number of digits after the decimal point and the terminating null at the end so in this case for 5 places you need a char[] of size 8.

NathanOliver 429 Veteran Poster Featured Poster

if this computer is a tower and not a laptop you can open the case and there will be a jumper on the board that will clear the bios password. you will have to look up the motherboard specs tough to find out where the jumper is at.

NathanOliver 429 Veteran Poster Featured Poster

but he said he needs to convert the inputed number so wouldnt that imply that he needs to use cout to ask for the number and cin to get it?

NathanOliver 429 Veteran Poster Featured Poster

just for your information you do not need to implicitly define the delimiter as a newline in getline() it is already set there and if you want to change it the you must specify what you want. at least that is according to the msdn for visual c++ 6.0 professional

NathanOliver 429 Veteran Poster Featured Poster

sorry posted on accident and i cant find out how to delete it

NathanOliver 429 Veteran Poster Featured Poster

i just new i had seen this problem before just couldnt find the thread to get the link. siddhant3s your equations look better than mine :(

NathanOliver 429 Veteran Poster Featured Poster

he told you not to put the type in when you call the function not when you declare or define the function

//...
StuRead(students); // good no data type before variable
//...
void StuRead(ifstream &inFile, studentType students) // good data types befor the variables
{
//...

hope this clears it up

NathanOliver 429 Veteran Poster Featured Poster

you defiantly can use an if statement and keep track that you have an undefined slope because a slope of 0 would be perpendicular to that.

NathanOliver 429 Veteran Poster Featured Poster

An easy way to solve this problem is by find the slope of the three lines and checking if any of the slopes happen to be negative reciprocals of the remaining two...

Slope(m) = (Y2 - Y1) / (X2 - X1)

the only problem with this is that if the triangle has a horizontal leg and a vertical leg you will have division by 0
(0,4) , (4,1), (0, 1)

(4 - 0) / (1 - 1) = undifend

NathanOliver 429 Veteran Poster Featured Poster

yes because when you have more then one element on a line in the file such as numbers and spaces the indirection operator does not know what to do with the numbers. in cases like this you need to get the information the the form of char variables and convert them. i hope you can understand what I'm saying i might not be explaining it exactly right.

NathanOliver 429 Veteran Poster Featured Poster

you need to use the distance formula to get length of the legs of the triangle and then the Pythagorean theory to see if its a right triangle.

distance formula = sqrt( (x2-x1)^2 + (y2-y1)^2 ) )
Pythagorean theory = a^2 + b^2 = c^2

NathanOliver 429 Veteran Poster Featured Poster

alright in this case i believe that you will need to get the data from the file using character strings and then convert it to an integer using atoi();

NathanOliver 429 Veteran Poster Featured Poster

would you mind uploading your text file?

NathanOliver 429 Veteran Poster Featured Poster

if you place a cout statement on line 22 to display the values what do you get? also on lines 20 and 21 instead of = NULL; use = 0;

NathanOliver 429 Veteran Poster Featured Poster

im not exactly sure but i dont think you can pass an oppened ifstream object. try opening the ifstream object in your build function

NathanOliver 429 Veteran Poster Featured Poster

sorry but i made a mistake on line 8 you should use if (strcmp(equationResualt, pi) != 0) and on line 13 you should use if (strcmp(equationResualt, pi) == 0) sorry but it was late and i wasn't thinking strait.

NathanOliver 429 Veteran Poster Featured Poster

for this part of code

char * pChar[255];
pChar = new char[255];

you do not want to declare pchar with its elements. you save that for the new operator part. so you would want to do this

char * pChar;
pChar = new char[255];

also when you delete an array you always want to place the array operator before the name of the array. otherwise you will just delete the head of the array but the rest of it will still be sitting there in memory taking up resources until your application exits.
make sure you alway use delete [] variable_name; also it is always a good idea to set your pointer to null after deleting it. deleting a pointer that has already been deleted is guaranteed to crash your system but deleting a null pointer is safe.

NathanOliver 429 Veteran Poster Featured Poster

it converts a float to string

char *_gcvt( double value, int digits, char *buffer );

value

Value to be converted

digits

Number of significant digits stored

buffer

Storage location for result

the string stores the decimal point so you need to make sure you have room for it thats why i have char * pi = new char[digits + 2]; +1 wouldnt leave space for the null terminator so you have to use +2

NathanOliver 429 Veteran Poster Featured Poster

well you could do this

char * pi = new char[digits + 2];
char * equationResualt = new char[digits + 2];
_gcvt(counter1, digits, pi);
for (long int n=1; n<=10000; n++)
{
pi1 += (4*pow(-1.0, n+1))/(2*n - 1); 
 _gcvt(pi1, digits, equationResualt);
 if (*equationResualt!=*pi)
{//if start
counter++;
 }//if end
else 
 if (*equationResualt==*pi)
{
...

this converts the numbers into strings and then you can check them. also this will help you display the result since its already a string and formated to the precision you want. you will also need to add #include <stdlib.h>

NathanOliver 429 Veteran Poster Featured Poster
char input[50];  // makes an character array with 50 elements
cout << "Please enter an integer: ";  //ask for the integer
cin >> input;  // receives the inputed number as a character array

this is a good way to get inputs as strings if you are not allowed to use std::string yet.

NathanOliver 429 Veteran Poster Featured Poster

so you need to have the user enter a integer number and then you are to ouput that back to them in reverse order

NathanOliver 429 Veteran Poster Featured Poster

so what exactly is your problem?

NathanOliver 429 Veteran Poster Featured Poster

maybe you could convert pi and the number you are calculating to a string and then compare them. this way you could set the size of the string to be the precision you want.

NathanOliver 429 Veteran Poster Featured Poster

one problem will always exist. there are a lot of people like us out there and every time one of us comes up with a brilliant idea its just a matter of time before a another person comes up with a way to break it. take windows xp for example they came up with a way to have to activate the software but now you can google programs out the wazoo that will generate keys to activate it.