1,288 Posted Topics

Member Avatar for MasterHacker110

What input causes it to crash? Right now your crypto is very easy to break as it's not RSA. As I said in your other thread, **^** is *not* "to the power of".

Member Avatar for Moschops
0
301
Member Avatar for MasterHacker110

Seems like you don't understand pointers. Here is what I usually say about pointers to people learning about them. You are familiar with an int? An int is an object that takes up an amount of memory (commonly 4 bytes, sometimes 8) and stores a single numerical value. A pointer …

Member Avatar for Moschops
0
155
Member Avatar for ro7_ad

Line 70. That function is meant to be called **main**, I expect. Those headers have proper C++ versions. **cstdlib** and **cmath** You'll need to specify that you are **using namespace std;** Rip out calls to **exit** and replace them with **return**.

Member Avatar for NathanOliver
0
452
Member Avatar for Dolby779

How would you do this on paper? Let's say that I give you two numbers (in decimal or hex, whichever you prefer to think about), and I ask you to write them down as ONE number, in such a way that you'd also be able to separate them out again …

Member Avatar for Nick Evan
0
415
Member Avatar for mattboy64

If you show us the code, we can tell you waht's missing. If I had to guess, you're missing a closing bracket, semi-colon or similar such syntax.

Member Avatar for Adak
0
222
Member Avatar for sunnyy221
Member Avatar for mattboy64

// top level int stock1 = 0; // first way - pass by value and get return value stock1 = alterValueOne(stock1); // second way - pass a pointer to the variable alterValueTwo(&stock1); // functions int alterValueOne (int input) { int temp = input + 7; return temp; } void alterValueTwo …

Member Avatar for mattboy64
0
225
Member Avatar for MasterHacker110

I see you're using the XOR operator here: m ^ e Did you mean to do that, or are you looking for the **pow** function? I see that at the end you output a single char only. Is that where you're expecting to see all the char output?

Member Avatar for MasterHacker110
0
149
Member Avatar for sana.f.qureshi

You've got lots of problems in this code. The first thing I see that will break it is that you're trying to store the user input for their name as an integer. If they enter letters as their name, this will go horribly wrong and break all the following inputs.

Member Avatar for sana.f.qureshi
0
191
Member Avatar for Huxaifa
Member Avatar for tadas.bareikis

isdigit expects a single character. Just one. It's meant to be used to check if a single character is a digit (so the input is expect to have a numerical value in the range zero to 127 for a char, because those are the values a char takes - see …

Member Avatar for Moschops
0
170
Member Avatar for artur.sinelnikovs

#include <string.h> (so the compiler knows about the function) sizeof (struct trainset)

Member Avatar for sanket044
0
147
Member Avatar for dangkhoaddt

This is impossible. There is no way to know when you find the end of the array. It is up to you as the programmer to keep track of the size of the array when you make it.

Member Avatar for dangkhoaddt
0
202
Member Avatar for highonbikes

The only issue I can see is that sometimes you use the type client and sometimes you use Client. C++ is case-sensitive. It should be returned a pointer to Client.

Member Avatar for Moschops
0
133
Member Avatar for boris90

If your compiler is up to date, it will support regular expressions (#include <regex>), which means you can do something like this: regex userName("someString"); regex passWord("someOtherString"); while ( //loop over whole file, reading in two lines at a time and sticking them in stringFromFile) { if (regex_search(stringFromFile.begin(), stringFromFile.end(), userName)) { …

Member Avatar for Moschops
0
663
Member Avatar for blitzkrieg64

If you just want to access pixel values, there are simpler ways. I like the CImg library. #include "CImg.h" #include <iostream> using namespace cimg_library; int main() { CImg<float> image("image.bmp"); CImgDisplay main_disp(image); // Display it, just for fun float pixvalR = image(10,10,0,0); // read red val at coord 10,10 float pixvalG …

Member Avatar for Moschops
0
282
Member Avatar for rbean10

**What I have so far translates individual characters perfectly. But I can't seem to translate whole lines/words.** You read the input into the variable originalChar, which is a char. One char. Your function for decoding takes in one char, and the key, and returns one char. If you want to …

Member Avatar for Moschops
0
565
Member Avatar for existinglady
Member Avatar for DonutsnCode

[code]double & Getsomenumber() { double number = 12.4; double &anotherNumber = number; return anotherNumber;}[/code] As soon as this function ends, the variable number is removed and no longer exists. What does the returned reference actually refer to? Something that no longer exists.

Member Avatar for elmohler
0
940
Member Avatar for cent91

[QUOTE]Top reading that book! The compiler is old, non-c++ compliant, and the version of MFC that it teaches is also obsolete. If you want to learn MFC then get a book that teaches it from VC++ 2010 compiler. [/QUOTE] I respectfully disagree with that; I found the best MFC book …

Member Avatar for thines01
0
631
Member Avatar for happygeek

[QUOTE]C/C++ programmers are becoming dinosaurs for a reason...[/QUOTE] That is so true. I can't think of a single operating system, huge application or multi-million dollar game from the last year that was written in C and/or C++.

Member Avatar for MoZo1
0
652
Member Avatar for Vasthor

You've not installed your compiler properly. Particularly, the path to the files it needs.

Member Avatar for Vasthor
0
227
Member Avatar for Deepthikota

#include "CImg.h" using namespace cimg_library; int main() { CImg<unsigned char> src("imageName"); int R = (int)src(c,r,0,0); int G = (int)src(c,r,0,1); int B = (int)src(c,r,0,2); return 0; }

Member Avatar for Moschops
0
57
Member Avatar for pjh-10

[B]i understand the 1/1000 chance then theres another 1/1000 chance of getting the song again next time, meaning 1/1000 X 1/1000 chance of getting the same song twice in a row using the shuffle.[/B] That's an analysis of not getting a SPECIFIC song twice in a row in two sequential …

Member Avatar for pjh-10
0
442
Member Avatar for nana0

&(i) = new BrokenPart(i); This says: take the address of the object i (i.e. the number of the memory slot where i is) and change it so that it is equal to this other thing on the right (which is a pointer). That makes no sense. How can you change …

Member Avatar for Moschops
0
133
Member Avatar for nikhil patwari

Your chosen C++ development environment is so old that it doesn't have _getpid. Use something else.

Member Avatar for Moschops
0
14
Member Avatar for radiat

Since you created it, shouldn't you already know? [CODE]int x; // this one is an int float y; // this one is a float[/CODE]

Member Avatar for dragon8001
0
4K
Member Avatar for infamous1987

Get weight value from user. Get MET score for activity. Get time spent doing activity. Output (0.0175 * MET * time * weight/2.2) Which of those can you not do?

Member Avatar for Software guy
0
1K
Member Avatar for Suzie999

[CODE]const uchar i0 = '30';[/CODE] '30' is not a single char, so there's the first problem. The single char: [B]char x = 30;[/B] is fine. In this case, the char is the RECORD SEPARATOR character, as show here: [url]http://www.asciitable.com/[/url] I don't know quite what you expected to add up to …

Member Avatar for Moschops
0
431
Member Avatar for doma18
Member Avatar for aderogba08
Member Avatar for aderogba08
0
226
Member Avatar for Candace Parker

To change the contents of a file, the easiest way is to copy everything (but changing the bit you want changed, or just not copying the bit you want deleted) to a new file, delete the old one, and rename the copy.

Member Avatar for Moschops
0
3K
Member Avatar for Esmerelda

What exactly are you trying to do? [B]isdigit('1')[/B] will always have the same value. [B]isalpha('a')[/B] will always have the same value. Why bother using a function to generate values that never change and are always the same? What are you trying to do here?

Member Avatar for WaltP
0
126
Member Avatar for SDDMV
Member Avatar for emmasmart

[url]www.norvig.com/21-days.html[/url] [url]samizdat.mines.edu/howto/HowToBeAProgrammer.pdf[/url] [url]www.catb.org/~esr/faqs/hacker-howto.html[/url]

Member Avatar for Moschops
0
114
Member Avatar for KRUX17

Sounds like you want to delete a value from the file "Tickets Left.txt". To do this, you'll have to make a new file, copy everything across that you want copied across, delete the old one and then name the new one with the same name.

Member Avatar for KRUX17
0
107
Member Avatar for faraz ahmad

You are changing ptr BEFORE you copy the contents of the array, so when you copy ptr, you're copying garbage values. You're also causing memory leaks repeatedly; you [B]delete [/B]each array once, at the end, but you call [B]new [/B]many many times in your looping.

Member Avatar for MastAvalons
0
343
Member Avatar for learner guy

[B]its returning false every time , thats the real trouble bcz apparently code looks fine [/B] This returns true. Perhaps you never gave it any decent test data. [CODE]#include <iostream> #include <cstring> using namespace std; bool substring(char A[],char B[]) { int aSize=strlen(A); int bSize=strlen(B); bool matched =true; int count =0; …

Member Avatar for Ali_2101
0
349
Member Avatar for prasenjit_das

Get first pointer. Count size of string. Get second pointer. Count size of string. Allocate new memory big enough for both strings. Copy contents of first string into new string. Copy contents of second string into new string.

Member Avatar for L7Sqr
0
163
Member Avatar for scottd82

There are many ways to do this. Here are two ideas: In your code above, each time you draw a card, check to see if you've alredy drawn that one. If you have, reject it and draw another. Create all the cards in some suitable container - vector springs to …

Member Avatar for WaltP
0
1K
Member Avatar for ProgrammingGeek

[CODE]#include <iostream> class test { public: int* num; }; int main() { test *d = new test; d->num = new int; *d->num = 3; std::cout << *d->num; }[/CODE] Edit: Beaten to the punch by seconds!

Member Avatar for ProgrammingGeek
0
139
Member Avatar for Karlwakim

Don't neglect maths. I am constantly interviewing coders who appear to have memorised all the syntax there is but can't explain to me how to manipulate vectors or normalise values (as just two examples).

Member Avatar for jbennet
0
90
Member Avatar for MasterHacker110

This is the exponentiation cypher, upon which RSA is based. Let's start with this. Pick a prime number, p. Pick another prime number e (smaller than p), making sure that e and (p-1) are relatively prime. Now, take your plaintext. Replace each letter by numerical equivalent (00 for A and …

Member Avatar for Moschops
0
331
Member Avatar for sinatra87

You're going about making the 2D array the wrong way. You have to separately create each 1D element of it: [CODE] Tests = new double*[numStudents]; for (int i = 0; i < numStudents; ++i) Tests[i] = new double[numTests];[/CODE]

Member Avatar for sinatra87
0
247
Member Avatar for skannigan

[CODE]while (notFinishedReading) { in_stream >> name; in_stream >> combo; in_stream >> op1; in_stream >> op2; in_stream >> op3; in_stream >> op4; // Do something with the data }[/CODE]

Member Avatar for Ancient Dragon
0
212
Member Avatar for radiat

[QUOTE]But what is the point of dynamic memory for a single type?[/QUOTE] What would you prefer? A minimum size permitted for dynamic memory?

Member Avatar for radiat
0
126
Member Avatar for ginan

[CODE]getline(indata, temp[num].time);[/CODE] See that value, [B]temp[num].time[/B]? That's a [B]double[/B]. The getline function doesn't know what to do with it. It only knows what to do with strings. [B]temp[num].isEasy[/B] - that's a bool. The getline function doesn't know what to do with it. It only knows what to do with strings. …

Member Avatar for ginan
0
9K
Member Avatar for tanvirraj91

Does he mean "DOS", or does he just mean a command line window, in MS Windows? Anyway, clang is not VB. Use clang, as L7sqr suggested.

Member Avatar for DeanMSands3
0
168
Member Avatar for sagarnarasgonde
Member Avatar for Moschops
0
168
Member Avatar for Karlwakim
Member Avatar for Karlwakim
0
121

The End.