Member Avatar

I have created a histogram program that has the user enter the lower limit of the range, then generates a 20 number array with that number at array[0] and the lower limit + 20 at array[20]. It then does a random number generation where 85% of the randoms are within the range and 15% are outside, and counts how many fall outside of the range. Then it counts occurances and prints a histogram that shows the amount below range, then prints the range (number, count, #'s or *'s), a # sign is printed for every 10 occurances that a number …

Member Avatar
+0 forum 5
Member Avatar

I am working on the last part of an encryption/decryption program and have to compare the original input file to the final output file character by character to ensure that they are identical. I have tried a few different ways to do this to no avail. When I tried this code: [CODE] inputFile.get(inputChar); outputFile.get(outputChar); while(inputFile.good() && outputFile.good()) { if(inputChar != outputChar) { cout << "The files are not identical\n\n\n"; return 1; } inputFile.get(inputChar); outputFile.get(inputChar); } if(inputFile.eof() && outputFile.eof()) { cout << "The files are identical.\n\n\n" << endl; } else if(inputFile.eof() || outputFile.eof()) { cout << "One of the files has …

Member Avatar
+0 forum 10
Member Avatar

I am working on an Encryption/Decryption program for class and have run into a problem. I seem to have gotten the encryption correct, but I am unable to decrypt what was encrypted in order to get an output equal to what originally went in. Here is the code I have so far: [CODE]#include <iostream> #include <fstream> using namespace std; int main() { char userInput[24], inputFileName[51], encryptionFileName[51], outputFileName[51], encChar, decChar; int weightedSum = 0, modSum = 0, currentPos, intValue, fileValue, encVal, endEnc, decVal, endDec; fstream inputFile; fstream encryptionFile; fstream outputFile; cout << "Input string: "; cin >> userInput; //**********Create Encrypt/Decrypt Value*************// …

Member Avatar
+0 forum 14
Member Avatar

I am just wondering if there is a way to put the following code into a loop or two so that it is easier on the eyes and doesn't take us so many lines. I have not been able to think of a way to do this with so many different characters all equaling a different amount. By the way this is for a program that computes software code validity, and the program works fine as is, just trying to consolidate some code. I apologize for the wall of code here. Thank you for your help in advance. [CODE]for(int b …

Member Avatar
+0 forum 6
Member Avatar

First off, I do want to state that I have read the forums and have not found an issue directly regarding this exact problem, though it is possible I may have overlooked it or something and if so please just point me in the right direction and I will leave you alone. The program I have been writing is a prime number checker, just to check to see if the number input is prime and list numbers up to that number that are prime also. The program is working fine, the listing functions correctly and it properly identifies whether the …

Member Avatar
+0 forum 11

The End.