181 Posted Topics

Member Avatar for NathanMc

Do some research on the getline() function. It is in the iostream library. It has an overloaded form that accepts a third argument which is the delimiting character.

Member Avatar for hag++
0
176
Member Avatar for gmfreak1991

I'm not really sure what your trying to accomplish here. Your for loop is incorrect because what if the file doesn't contain 81 characters? What if the file has a string with more than 81 characters? When checking for an EOF, consider looping through with a while statement like [CODE=c++]while(!inFile.eof())[/CODE]. …

Member Avatar for gmfreak1991
0
520
Member Avatar for hag++

Hi All, I am writing an MFC Tic Tac Toe app and I am getting a strange error when debugging it. This module loads a bunch of BOOL variables to keep track of whether or not the tile next to it matches (i.e is the tile next to me also …

Member Avatar for hag++
0
362
Member Avatar for sharifyboy7

cipherText was not declared in main(). When I compiled this I had to add [CODE=c++]string cipherText;[/CODE] to main(). Your encryption and decryption functions are going to need some work because saying something like cipherText[i] - key is not going to remove the int from the end of the string (If …

Member Avatar for hag++
0
264
Member Avatar for Lance5057

When you say "only seems to run once then does nothing." do you mean the program hangs or crashes or it only goes through one iteration and then exits?

Member Avatar for Lance5057
0
111
Member Avatar for neural_jam

Something simple like this?? [CODE=c++]const int SIZE = 10 // Or whatever size you want the array to be int array[SIZE]; ofstream oFile("c:\\someDirectory"); // Load Array for (int i = 0; i < SIZE; i++) array[i] = i; // Output to file for (i = 0; i < SIZE; i++) …

Member Avatar for neural_jam
0
2K
Member Avatar for crodriguez08

You need to make the lList class inherit from the Node class if you want to access the protected members in Node from lList. [CODE=c++]class lList : public Node { // Insert code for class } [/CODE]

Member Avatar for hag++
0
210
Member Avatar for enja

One way of doing it would be to use a 2 dimensional array of strings. For example: [CODE=c++] // Array that will hold 10 different lyrics, up to 20 words per set string lyrics[10][20]; [/CODE] Now say that song number 4 is chosen and you want to randomize which word …

Member Avatar for enja
0
96
Member Avatar for hockeygurl35

Well first, you are going to want to modify your add_record function. It is better practice to do most of your cout's and cin's in main (or in this case you can also do them in menu() ) and pass the arguments to the function to add them to the …

Member Avatar for hockeygurl35
0
190
Member Avatar for fukki

In the parameter list for your function prototypes and definition you need to declare the parameter as accepting an array of that struct type. Example: [CODE=c++]void showMenu(airplane arr[], int numberOfTickets); [/CODE] When passing arguments to that function, only pass the name of the instance of your airplane struct. Example: [CODE=c++]showMenu(tickets, …

Member Avatar for kes166
0
139
Member Avatar for codingNewB

You cant get the file to open? Does the file exist in your project directory? Also, in lines 37 and 38 you do: [CODE=c++]if (i % 2 == 0) evenSum += i; if (i % 2 > 0) oddSum += i;[/CODE] You have never initialized i with a value. This …

Member Avatar for codingNewB
0
769
Member Avatar for usagi

Unless you have to constantly read/write from the file as a requirement for the project, I wouldn't do that. I would load all the data (Since these files are not large) into a data structure of your choice (Anything from a simple array of structures to a linked list, binary …

Member Avatar for usagi
0
203
Member Avatar for Rayanjaha

The other possibility is that the prof wants one object to hold the data about the rectangle and another object that can perform operations on it. EX. [CODE=c++]class Rect { double len, wid; public: Rect(double l, double w) : len(l), wid(w) {} double getW() {return wid;} double getL() {return len;} …

Member Avatar for mrnutty
0
117
Member Avatar for MrJNV

Explaining how file streams work in detail is not going to be something that anybody here really wants to do. What you should do is study up on file IO (Using your book, interwebs etc.), write some test code and post it with any questions/ problems.

Member Avatar for hag++
0
310
Member Avatar for tehmarto
Member Avatar for tehmarto
0
145
Member Avatar for Jennifer84
Member Avatar for shawnisalk

[QUOTE]My question was more like, how does Windows work?[/QUOTE] WTF?? This question is going to take a lot longer to answer than you think lol [QUOTE]The intent behind my program is to replace all the functionality of the mouse with key presses. It will not have a graphical component. It …

Member Avatar for shawnisalk
0
326
Member Avatar for aman rathi

Keep in mind that different compilers may not interpret your code the same way. You may have to modify it. Can you post the code that you have?

Member Avatar for usagi
0
275
Member Avatar for Jennifer84

Keep in mind that windows Vista and 7 have much more memory read/ write protection than XP did. Try right clicking on your executable file in Vista/ 7 and choosing 'Run as Administrator'.

Member Avatar for Milton Neal
0
317
Member Avatar for s080072

I have a feeling this "skeleton code" was the code given to you by the teacher. This isn't a finish your homework for you club.

Member Avatar for hag++
-2
85
Member Avatar for emko

Yea your approach is definitely a little off so far. Do you want your program to count how many times a letter (that you specify) appears in a certain string? For example: How many times does the character 'p' appear in the string "apples"? And you want your class to …

Member Avatar for mrnutty
0
258
Member Avatar for Lord_Migit
Member Avatar for TheSecOrg

Just by looking at the questions you are asking, I can tell you are not ready for this type of programming.

Member Avatar for PixelExchange
0
120
Member Avatar for hag++

Hi All, I have been programming for a while, currently a junior CS student. Programming has always felt very natural to me and I pick up new concepts quickly and I generally retain most of what I learn. However, when it comes to converting between Dec/Bin/Hex as well as performing …

Member Avatar for embooglement
0
174
Member Avatar for mommabear

[CODE=c++]name = new char[n];[/CODE] You are allocating memory for a new char array but you are using a variable with data type char for the size declaration. n is a char type and should not be used to declare the size of the array and it is never initialized or …

Member Avatar for mommabear
0
108
Member Avatar for Ghazanfar Ali

Welcome to the forums. I recommend reading the forums rules because you will see that people will not help you with these kinds of questions. You need to first learn the basics of what to do (Read books, classes, etc...), post your code, then if you have problems people here …

Member Avatar for Fbody
-1
65
Member Avatar for Rickay

The structure of you program overall is a little off. The option to Quit should really only be contained in the main program loop. So you should present all of the options that the program can do (which includes quit) just in the main menu.

Member Avatar for jonsca
0
171
Member Avatar for Codname47

[QUOTE=Codname47;1270271]node &getNode(int index) { //NOT TESTED if (index <= getLength() || index >= 1){ temp = new node; temp = head; for (int i=index-1; i>0; i--){ temp = temp->next; } return &temp; } } Hi everyone, I receive this error msg: "invalid initialization of non-const reference of type 'node&' from …

Member Avatar for mrnutty
0
116
Member Avatar for thatom

Well that sounds like fun...... Why don't you start by posting code that you have already written so we can take a look at it. Nobody here is going to do the work for you

Member Avatar for mitrmkar
0
212
Member Avatar for Obsidian_496

[QUOTE=pinsickle;1210672]I have always done something like this [CODE]if (!myfile) { // error message // exit (1) } // do file stuff here [/CODE][/QUOTE] I usually do this as well..... however you can use the fail method which is contained in the newer fstream lib [CODE=c++] ifstream someFile("whatever.txt"); if (someFile.fail()) { …

Member Avatar for hag++
0
160
Member Avatar for natasha_sfu

Ok so first off.... code tags. And second.... what the heck is this?? [CODE] if string openfile(" image.bmp") [/CODE]

Member Avatar for hag++
0
110
Member Avatar for bl@ck_d3ath-v2

[QUOTE=niek_e;1107865]Try reading the rest of the replies in this thread and then figure out why you're not going to get it.[/QUOTE] Lol... some ppl never learn

Member Avatar for NathanOliver
-2
1K
Member Avatar for miskeen

You just want to dynamically allocate a new array of your struct right? Like this: [CODE=c++] myStruct* mySimpleClass::myFunc1 (int arraySize) { myStruct struct1 = new myStruct[arraySize]; return struct1; } [/CODE]

Member Avatar for miskeen
0
162
Member Avatar for vbx_wx

I agree with matt, HKEY_CURRENT_USER is just a const value or enumerated type, so you would need something like a switch case statement to cout the textual representations

Member Avatar for vbx_wx
0
72
Member Avatar for Lukezzz

What about calling the generateString function within your buttonclick function, except have generateString return the string instead of void [CODE=c++] private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { String^ getgenerateString = generateString(); } String^ generateString() { String^ sendThisString = "SendThis"; return sendThisString; } [/CODE]

Member Avatar for Lukezzz
0
156
Member Avatar for Lukezzz

Well the problem with that is once a .DLL is compiled you can't edit it directly, you need the C or CPP source file(s) used to create that DLL, then you edit those

Member Avatar for hag++
0
74
Member Avatar for sjgman420
Member Avatar for Freaky_Chris
0
885
Member Avatar for Juicy5ursoul

People on here are not going to respond to your post, it is junk. Why? Well first please read the posting rules (that will pretty much tell you why) You can't just say heres my program, what do I do to finish it? You need to put in the effort, …

Member Avatar for WaltP
0
183
Member Avatar for Pynolathgeen

I have gotten the Side by Side config problem before. I made a simple program to modify the Windows XP registry Hive files using the Win32 API and it worked fine on my laptop (The comp that I created it on) However on some computers and in a PE enviroment …

Member Avatar for Pynolathgeen
0
113
Member Avatar for moqbel

Its kind of hard to help because I don't know what your input files look like but I noticed two things. Lines 21 and 80 are [CODE=c++]while (source.fail())[/CODE] Those should be if statements because it will continuously loop if the file open process fails. Also, have you put a couple …

Member Avatar for moqbel
0
96
Member Avatar for kinglaplace6422
Member Avatar for hag++

Quick question. I have a program that will run perfectly fine in the Debug version (Using MS VS 6) but when I set it to Release and build it, then set the command line arguments (or run it from the comman line) it blows up. Any ideas why this would …

Member Avatar for mrnutty
0
264
Member Avatar for Prota

We help users based on specific question, not "Can you do this for me?" Start with a UML diagram to model ure class and go from there. If you get stuck at a specific point, post the code

Member Avatar for hag++
-1
135
Member Avatar for yakovm

Provided I have no code to look at, if your programming in windows you need two "\" in the filename if you are defining the path explicitly. However, the way you are doing it you only need to type one backslash. Have you tried outputting szFileName to see what it …

Member Avatar for hag++
0
91
Member Avatar for heynow12

Also in line 30 you have [CODE] for (int k = 1; k = 0; k++) [/CODE] the problem is that you are not testing for anything, you are reassigning k to 0 because you are using the single equals

Member Avatar for phyrtech
0
170
Member Avatar for ruin

Dude, you've already been told about code tags and where to use them, AND where to find info about them on the forum. I cant help you if I cant read your code... i.e the messy brackets in your nested loops because of the lack of code tagging

Member Avatar for jonsca
0
112
Member Avatar for hag++

Ok, having some serious trouble here. My proffesor told us to write a progrm (what it does really doesnt matter here) however he wants a FULL color menu in the console. He showed us an example of what he wants, it was very cool, it had a red backround, then …

Member Avatar for hag++
0
571
Member Avatar for devster123456

normally we try to help people here an not do the work for them but yea.... ok

Member Avatar for Agni
0
452
Member Avatar for geoldr

[QUOTE=geoldr;1126202]That's what I am trying to do but am not exactly sure how to get my file contents into an array.[/QUOTE] Well there are a bajillion ways to do that but.... a quick dirty way: [CODE=c++] fstream iFile("myFile.txt", ios::in | ios::beg); const int MAX = 15; string words[MAX]; int index …

Member Avatar for hag++
0
111
Member Avatar for mikabark

i Know ure new to posting here so... please read the "Before you Post" guides in the forum list. USE CODE TAGS!

Member Avatar for WaltP
0
114

The End.