75 Posted Topics

Member Avatar for HeartBalloon

As Nandomo suggested, you need to use strncpy. You are using the char arrays as C strings, and as such, they use a different method than normal char arrays, or even strings. It would be easier if you just changed all the types (chars) to string. So you'd have [CODE] …

Member Avatar for Nandomo
0
145
Member Avatar for moreautemps

Good luck trying to contact Mr. Bill for that answer. I suggest googling it. As I just did, [url]http://www.makeuseof.com/tag/5-ways-to-make-your-own-screensavers-windows/[/url] Question? How is this related to C++? If you have any program that you would like use to look at, I know I would be interested in seeing any progress you've …

Member Avatar for moreautemps
0
113
Member Avatar for kotddanny

This is what I ended up writing. [CODE] #include <cstdlib> #include <iostream> using namespace std; void compare(int problem[], int SIZE); int main(){ . . . . /* I placed this following section at the very end of your program, between the last else statement and your system pause. */ int …

Member Avatar for kotddanny
0
132
Member Avatar for icasta13

Glad you got the answer :D I would suggest you use the following whenever you use a file for data. It may help with an immediate solution that would otherwise be directly hidden from you. [CODE] ifstream fin; fin.open ("1.txt"); if(fin.fail() ){ cout << "Input file failed to open.\n"; exit(1); …

Member Avatar for icasta13
0
214
Member Avatar for Badoodhi
Re: C++

Please show us what you have done so far. Paste in some code, show some work, and we can then help you.

Member Avatar for alexchen
-5
117
Member Avatar for Mr_PoP

You also may want to read up on strings and string input, from what I read from multiple other sources, you want to be using the standalone function getline(cin, npcname) vs the regular cin >> input. Mixing cin >> with strings may give some funky results.

Member Avatar for Saith
0
77
Member Avatar for jlianne18

This is what I ended up coming up with. First you want to make sure you can open your file. If you cannot open your file, your arrays will automatically be filled with junk. That may be half of your problem. After that, I just used cout << as a …

Member Avatar for Saith
0
201
Member Avatar for Mr_PoP

This is what I came up with. The code works for any valid input from 1 - 9. You can change the range from a number higher than 9 or lower than 1. [CODE] #include<iostream> using namespace std; int main(){ int number; cout << "Please input a number 1 - …

Member Avatar for Mr_PoP
0
145
Member Avatar for icasta13

Seem like your coding structure is a little off, perhaps something like this? This is just a snippet of what I just wrote, but I did write the entire program to make sure the snippets work properly. The output seems correct with the desired input in the array. I won't …

Member Avatar for icasta13
0
273
Member Avatar for indr

The question is why you would want to know the exact location of variable char a. It's useless as when the variable is initialized with the onset of the program, the variable will be in a different memory location. Hence, hard coding memory locations will be meaningless. [CODE] #include<iostream> using …

Member Avatar for embooglement
0
150
Member Avatar for staz
Member Avatar for Kanoisa

I just started back into C++ from taking some time off from it as well, slight rusty, but let's see if I can give you a shot at what you are asking for. class FullOfFunctions{ public: void function(int happy_num); //pass by value void function2(int & happy_num); //pass by reference private: …

Member Avatar for Kanoisa
0
166
Member Avatar for jackmaverick1

Instead of having the user input a statement, have the program ask a question and the user reply with yes or no. At which point, if the answer is yes, you lead down one road of possibilities to what the answer is. Otherwise, head the other direction. Having the user …

Member Avatar for JSPMA1988
0
160
Member Avatar for jackmaverick1

#include <string> You can assign value by, int main() { string name; name = "This is a string. Don't forget to use double quotes instead of single!"; cout << name; Output: This is a string. Don't forget to use double quotes instead of single! This string class has a lot …

Member Avatar for Saith
0
134
Member Avatar for zit1343

Just a quick note. What you had earlier, char name; is the same as char name[1]; // variable holding 1 character // They changed it to 30, char name[30]; // so that any input you enter will have enough space to be saved to the variable "name".

Member Avatar for Saith
0
152