I want to write encryption algorithm.first af all I need to define variable( binary input ) that it is 256 bit but I dont know what should I use...then I want to XOR this to variable ( a & b ) ( each of them is 256 bit)
I am making a function that will return a pointer to a long long variable. For example, I have the next variable prototype: Code: long long funcName(long long x, int s); I want to change the return value, and the first parameter to pointers to long long.
So I have been given and as part of the solution I need to count the number of digits in a long long variable. To do this I use a while loop, but it is behaving strangely. Here is the code.
#include <stdio.h> #include <cs50.h> #include <math.h> int main (void) { printf("What is the card number?"); long long card = GetLongLong(); if(card <= 0)
[Code] .....
When I execute the program it asked for the number, but then nothing happens. Of course, my first instinct was that the program was caught in an infinite loop somehow, but could not figure out how. I commented out the while loop and the program completed (albeit returning the incorrect value), so I was further convinced that there was an infinite loop that I was not seeing. I ran the program throug gdb. Strangely, the program did not loop infinitely, instead it got to line 16 [while(card1 > 0] and then just stopped, it was not executing the next line of code at all.
I've written a code that request for a password and its suppose to look like this.
Sample Output (inputs in bold) Please enter a password: pass6 Passwords must be at least 7 characters long Please enter a password: TarrantNW Passwords must include a digit or dollar sign (0-9, $) Please enter a password: Tccd-03
But when I run the program it stops at "Passwords must be at least 7 characters long" and the box closes and where I should put the loop=
#include <iostream> #include <cstring> #include <cctype> using namespace std; const int SIZE = 7; char password[SIZE + 1];
I have a problem with converting a C++ string into a long double. In order to do this, I used the function strtold, but the result I get is only the integral part, that is: if for example the input string is 12.476, I only get 12 as the converted long double value. This happens with atof too.
Here is my code:
#include <stdio.h> #include <stdlib.h> #include <string> #include <sstream> string test = "12.345"; long double test_longd = strtold(test.c_str(),NULL);
Working on a Project Euler problem and the question asks for the largest prime number that is a factor of 600851475143. As you can see, this is significantly larger than the maximum of a long data type, which maxes out at 2147483647.
I'm running on Windows 32, so int64 is not a valid option for me. It seems like I'll likely have to use a different language to solve this problem.
The problem, is that I dont know how to make Regex get Integers no matter what (e.g. even if an =, >,<,>=,<= sign is in front or anything) unless it is encased in a string e.g. "'s or whatever.
My current code does this:
I do not want the numbers to be highlighted if they are in a string.
I have some codes which are not efficient enough to get the answer faster.
Q: Tom is looking for a car with high miles per gallon and high horse power.For example:P1--Toyota with MPG=51,HP=134, the P2--Honda with MPG=40,HP=110, P3--Ford Fusion with MPG=41,HP=191,P4--Nissan with MPG=35,HP=195,P5--Volkswagen with MPG=30,HP=140
Since,p2 is worse than p1(in terms of MPG,HP) and p5 worse than p4(MPG,HP), thus they are cancelled. The leftover 3 cars are considered interesting cars.Tom wish to find all interesting cars from the list but there's too many of them. Thus write a program to find this list as fast as possible.(C++)
int SimpleAlgo2 (int &n, int &d, vector< vector<float> > &point) { vector<bool> isBest(n+10, true); for (int i=0; i<n; i++) { for (int j=0; j<n; j++) {
// We will check if point[i] is strictly worse than point[j] // no need to check if we already know that point[i] is not the best if (isBest[i]) {
I'm making a program that would run 24/7 and that could be run on multiple computers that are all running Windows (the program would be in the startup folder of the computer).
So I'm searching for 2 functions, one that would check if the program has been already launched on this computer and another one that would do a save every 24 hours. but for the second one I don't know what I should do because I think that a loop with sleep() would take too much power for the cpu
I am trying to print out 2^1000. I am not entirely sure on how to implement the constructor. I currently just have x.push_back(n) as my constructors implementation. For the function double(), it is suppose print 2^10 as 1024 and the function addDigits() should print 2^10 as 7. Am I suppose to create a Long object with 2 as a parameter and then use double() to double it 10 times?
#include <iostream> #include <vector> #include <iterator> using namespace std; class Long {
I have written a windows service which run continuously on a server. Interval time is 9 sec. On timer1_interval i am fecthing record from database and sending it to user. And changing its record status.
this service stop fetching records after running 4 to 5 days. We need to restart the service. there is no GUI involve in this code
I have to write a program, that multplicates very large numbers (out of range of long int). It's said that i need to use arrays and read the numbers as strings. My problem is to end function called "mnoz:, because i don't know how to sum the multiplicated values of arrays a and b.
I'm currently working on a simulation of the motion of magnets on a rod. As part of it, there are arrays of the properties of the magnets:
long double *accelerations; // These will later be dynamically allocated depending on the number long double *velocities; // of magnets long double *positions;
However, when I go to compile this, the compiler gives me these error for the pointers:
error: two or more data types in declaration of 'accelerations' error: two or more data types in declaration of 'velocities' error: two or more data types in declaration of 'positions'
Apparently, the compiler isn't recognising long double* as a type and is instead reading is as the two types long and double*.
I am trying to send the maximum long value through function call, but i didn't print proper value..
[ #include <stdio.h> long long floatToInteger_old(float value){ printf("float val : %e",value); } int main(){ float value = 340168346567; long long finalhexVal = floatToInteger_old(value); return 0;} ]
my actual output is 340168346567, but it is printing 3.401683e+011 or 340168343552.000000. how can print exact value what i am sending.
I only get like 500 chars, so I tryed a lot of different funcs until I finally realized that they reached the end of file "early" well it thinks that one of the chars in it is an end of file and it's located at the start. So I really don't know what to do with it because every func doesn't see the rest of the file at all.
My goal is to read a one line file of a comma separated numbers into a floating point array. The numbers have up to 25 positions after the decimal. I'm having two issues with the following code.
1) atof() seems to be returning zeros every time. Why?
2) The last number includes the new line character. How do I get rid of it?
Note that I adapted the scanf command from here: The power of scanf() - [URL], and don't completely understand it.
Code: #include <stdio.h> #include <math.h> //The following will be calculated in the real program. #define DIM 1 #define N 8 int main()
[Code]......
In the "real" program, N is calculated and known before reading in the file and the file will always have 2 times N numbers.
How can I read a file that contains numbers only, but read it by three digits at a time? I have a long string of numbers and every three digits corresponds to a particular number in itself. i.e. a string of 064045154 would need to be read as '064' '045' and '154'. I need to then subtract one from each of these numbers and the new values I need to convert into their ASCII characters and place these in a new file. This is what I have (focusing on the 'Decrypt' function) but all it does is in the new file place a string of the same character repeated over and over a total number of times equal to the number of integers in the numbers file.