1,358 Posted Topics

Member Avatar for johnnyturbo3

Have you tried changing [icode]#include <FileNames.h>[/icode] to something more like [icode]#include "FileNames.h"[/icode]? The behavior of #include <> is different from the behavior of #include "".

Member Avatar for Fbody
0
808
Member Avatar for ttx336

Dev-C++ is very outdated. When I started with C++, a little over a year ago, that was my first IDE. I'll be honest, i hated it. None of the features worked properly or in a timely fashion, the code complete would cause a crash 75% of the time. I got …

Member Avatar for sfuo
0
146
Member Avatar for saransh60

Actually, you can still resolve std::cout and std::endl globally so that you don't have to explicitly resolve them every time you use them. To do so, you would use individual "using" statements instead of a generalized using statement like [iCODE]using namespace std;[/iCODE]. [CODE] #include <cstdlib> #include <iostream> #include <string> //using …

Member Avatar for sfuo
0
143
Member Avatar for linziza

I'm answering because you mentioned that you have to learn C. You should be cautious about how you learn to do things because C++ is a "superset" of C. This means that it incorporates C into it and expands upon it. I might suggest "C++: The Complete Reference" by Herbert …

Member Avatar for Fbody
0
112
Member Avatar for fenerista

Have you tried using combinations of [URL="http://www.cplusplus.com/reference/clibrary/cstring/strtok/"]strtok()[/URL], [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/"]atoi()[/URL], and [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/atof/"]atof()[/URL]? strtok() tokenizes character arrays (c-style strings) and atoi() and atof() pull numbers out of strings.

Member Avatar for fenerista
0
119
Member Avatar for ttx336

A "token" is simply a unit of information that has meaning. For example, in C++ if you want to output to the console, you use the keyword [B]cout[/B]. The keyword [B]cout[/B] is a "token" that the compiler detects to tell it that you want to use the standard output stream/console. …

Member Avatar for ttx336
0
97
Member Avatar for seanzshow

The variable called "val" is not a pointer, it is another (completely separate) integer. It will not automagically update. You must perform another assignment. This code: [CODE]total = 3200;// assign 3200 to total ptr = &total; // get address o total val = *ptr; // get value at that address[/CODE] …

Member Avatar for Fbody
0
134
Member Avatar for technology

Other options for use of istream::get() are: [CODE] char inputChar = '\0'; cin.get(inputChar); [/CODE] or [CODE] std::string myString = ""; int charCount = 24; cin.get(myString, charCount); [/CODE] [URL="http://www.cplusplus.com/reference/iostream/istream/get/"]See this for more prototypes and examples.[/URL]

Member Avatar for ShadowScripter
0
197
Member Avatar for leeba

I would start by breaking up your code block like this, for ease of discussion: file1.h: [CODE] //header contents (class definitions) [/CODE] file1.cpp: [CODE] //implementations [/CODE] file2.cpp: [CODE] //your includes: #include "file1.h" int main() { } [/CODE] Doing this makes it easier to understand your project's file set up, which …

Member Avatar for leeba
0
97
Member Avatar for Frederick2

[QUOTE=Frederick2;1273498][CODE=C++] #include <stdio.h> int main() { int iBAF=10; int iPlots=14; double dblFactor; dblFactor=iBAF/iPlots; //to get a floating point you need a cast! printf("dblFactor = %10.6f\n",dblFactor); return 0; } /* dblFactor = 0.000000 */ [/CODE] I thought C/C++ would offer a few benifits beyond pure assembler. Apparently I was wrong.[/QUOTE] A …

Member Avatar for Fbody
0
356
Member Avatar for Fbody

I know they no longer appear, but people still link the C++ ones all the time: [url]http://www.daniweb.com/forums/announcement8-2.html[/url] [url]http://www.daniweb.com/forums/announcement8-3.html[/url] I'm sure they still link the other forum-specific ones frequently as well, I just don't visit those forums frequently enough to know. Are those gone too? They were working yesterday, but now …

Member Avatar for Fbody
0
51
Member Avatar for scrupply

The way your statements are written (with concatenation), if you have single quotes in your strings, the interpreter might be interpreting them as starting new literal strings. [CODE] //these are roughly equivalent $variable = "some string"; $variable = 'some string'; //the big differences are the way escape codes are expanded …

Member Avatar for Fbody
0
152
Member Avatar for Ghazanfar Ali

[QUOTE=hag++;1273630]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
64
Member Avatar for rakeshk_87
Member Avatar for Fbody
0
69
Member Avatar for csha_cs508

Can't... You haven't provided us with a sufficient description of the problem. At this point, all we can do is guess... Does the program compile? If not, what are the compile errors? If yes, what are you expecting the program to do and what is it doing incorrectly? Also, [URL="http://www.daniweb.com/forums/announcement8-3.html"]please …

Member Avatar for Fbody
0
2K
Member Avatar for BLKelsey

Both files have a variable called "loop" defined within them in the global scope. Those identical declarations are butting heads. I don't see your class definitions for HangmanMenu and MainMenu. Based on the way you are using the "loop" variables I think you would be better off moving them from …

Member Avatar for BLKelsey
0
184
Member Avatar for johndoe77

Here's a hint: You need to use parallel arrays here. The first is the menu items themselves, the second is a "counter" or "distribution" array. The counter array would have 1 integer element (initialized to 0) for each menu item. Then, as the customer orders items, you increment the appropriate …

Member Avatar for Fbody
0
123
Member Avatar for oneml

Your comments explain it all. Your array is only defined to be 9 elements long (see Lines 7 and 8), but you are processing it as if it were 10 elements long. example: Lines 18-22. Your while loop is overshooting the limits of your array. It runs from 0-9 (10 …

Member Avatar for mrnutty
0
261
Member Avatar for johnnyturbo3

You are attempting to call the function before it comes into scope. To fix this, you need to add prototypes for your functions to the top of your file. [CODE] //****** //***THIS EXAMPLE CONTAINS AN ERROR AND WILL NOT COMPILE/LINK //****** // the function someFunction has not come into scope …

Member Avatar for johnnyturbo3
0
702
Member Avatar for sjohnson

[QUOTE=sjohnson;1270121]I didn't mean to offend u. I've fallen behind in my class and in fear of failin. Nice slap back to reality. Hope I can get tips in the future.[/QUOTE] Not a big deal, you certainly may. Just be sure you follow the [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]forum rules[/URL] and the posting guidelines when …

Member Avatar for Fbody
0
88
Member Avatar for sjohnson

[URL="http://www.daniweb.com/forums/announcement8-2.html"]And what have you done so far?[/URL] If you actually put some effort into it, you might be surprised that you can be done with it in less than 15 minutes. [URL="http://www.cplusplus.com/doc/tutorial/functions/"]Some info on functions.[/URL]

Member Avatar for Fbody
-1
96
Member Avatar for Chaos3737

To generate a number within a specified range (i.e. -95 to 95, inclusive), you need to take a random number modulo the range. If the highest number in the range must be included, you take the modulo (range+1). Once you have taken the modulus of the random number, you add …

Member Avatar for arkoenig
0
152
Member Avatar for commelion

You aren't telling boat to inherit from transport. [URL="http://www.cplusplus.com/doc/tutorial/inheritance/"]Read this.[/URL] Also, there must only be one (1) main() in your entire program. It can not be part of any class, it must be globally-scoped. This won't work: [CODE] class someClass { int main() { return 0; } }; [/code] Neither …

Member Avatar for Fbody
0
338
Member Avatar for darelet

What is this "dataStructure" type that you are using? It appears to be a templated class... Is it something that you defined? If so, how is it defined? Is your class definition in your main file or in a separate header file?

Member Avatar for mitrmkar
0
383
Member Avatar for Stefano Mtangoo

I'm not familiar with CodeLite, but I'd say take another look at your project-creation options. I suspect that shared libraries (*.dll) and static libraries (*.a) are different project types. I know they are in Code::Blocks and in MS-VC++. Also check the MinGW documentation, you can probably just change a couple …

Member Avatar for Stefano Mtangoo
0
257
Member Avatar for bbman

Yes, to declare an array it would be [CODE] const int elementCount = 5 dataType varName[elementCount][/CODE] I wrote it this way because the old standard required that elementCount be a constant. Some compilers still enforce this. Newer compilers are starting to allow variables as the elementCount in lieu of constants. …

Member Avatar for Fbody
0
123
Member Avatar for mod666

The way you describe your situation is a little confusing. You'll have to show us what you have so that we can understand your description. It sounds like you want to define the function once and have it valid for every child class without re-defining it. To do that, you …

Member Avatar for Fbody
0
112
Member Avatar for timbomo

:confused: Why do you have 3 loops? You only need 1. The way you set those loops up, I don't even want to know what you'll get. A big mess, that much is certain. [CODE] ifstream inFile("input.fil", ios::in); if (!inFile) return EXIT_FAILURE; double decimalInput = 0.0; int intInput = 0; …

Member Avatar for Fbody
0
1K
Member Avatar for bubacke

If you put in a [iCODE]cout << vtoks[1];[/iCODE] after the line in question, what do you get? Do you get "daimler" or "volkswagen"? Also if you [icode]cout << vtoks.size()[/icode] what do you get, 4 or 5?

Member Avatar for bubacke
0
484
Member Avatar for jerryjerry

Private members (whether they be member variables/properties or member functions/methods) are only accessible by other members of the class that contains the private members. For example, class1's private members are only accessible by other members of class1, class2's members and main() are not allowed [B]direct[/B] access. To access the members, …

Member Avatar for Fbody
0
155
Member Avatar for Ayaat Monem

Recently, I wrote a dice game that was set up with several loops. To answer your question though. There is a loop in main() that I called the "application loop", much like jonsca suggested. This application loop was set up like this: [CODE] [B]//this is mostly pseudo code[/B] int main() …

Member Avatar for Ayaat Monem
0
148
Member Avatar for gedaahmed
Re: sort

[URL="http://www.sorting-algorithms.com"]Here's a site that will help you understand sorting sorting algorithms.[/URL]

Member Avatar for Fbody
0
73
Member Avatar for benji_k

I don't see any virtual functions. That's probably your issue. [URL="http://www.cplusplus.com/doc/tutorial/polymorphism/"]I suggest you read up on polymorphism, specifically "Virtual Members".[/URL] Oh, and read up on [URL="http://www.daniweb.com/forums/announcement8-3.html"][B][noparse][code] ... code tags ... [/code][/noparse][/B][/URL]

Member Avatar for Fbody
0
132
Member Avatar for abhi74k

Operators defined as members are treated like a member function of the left-hand operand with the right-hand operand becoming the parameter to the function. What both nathan and first are saying is that the A object being passed to the operator is the parameter, not the calling object. Declaring a …

Member Avatar for Aranarth
0
150
Member Avatar for kalrajhi

You seem to have the right idea, but you are defining your guess array to be an array of integers that is (0) elements long. It's not technically illegal, but it's very unsafe. There might be a better way to do it, but I would suggest you treat it more …

Member Avatar for kalrajhi
0
253
Member Avatar for iamcreasy

There's not really a "standard" for OOP design... There are really just processes with good/bad components to them and good/bad design ideas. What's a good design process and what's a bad design process is highly dependent upon on your personal Point of View. For a general overview of what is …

Member Avatar for avarionist
0
171
Member Avatar for Babatuda

Saying "...each time I compile I get this error massage,..." is too generic, it's not helpful. Give us specifics and we may be able to help... If what is Line 3 in your "snippet" is actually in your code, I'm not surprised there is an error. That should be a …

Member Avatar for avarionist
0
452
Member Avatar for Jennifer84

The name "stdafx.*" is the name that VC++ gives to its "precompiled headers"-related files. Some people have trouble with them, some don't. I don't know why. It seems your O/S rebuild introduced the environmental situation that causes the issue. Have you added anything to "stdafx.h" or "stdafx.cpp"? If not, disable …

Member Avatar for Jennifer84
0
285
Member Avatar for zyky

When your program hits the system("PAUSE") line, does it actually pause or does it blow right through it, without pausing?

Member Avatar for zyky
0
196
Member Avatar for leesho

The issue is not that there are extra/missing braces. The issue is that you are trying to define your *ThreeNumbers functions inside of main(). You can't do that. You need your prototypes before main() and definitions after main() like you had in your first version. You simply need to correct …

Member Avatar for leesho
0
184
Member Avatar for rowley4

I think you may have that backward dave. Shouldn't it be [CODE] std::stringstream ss; std::string myString; ss << yourThing; ss >> myString;[/CODE] ???

Member Avatar for daviddoria
0
136
Member Avatar for iamcreasy

Line 19 of "character.h" you need to add a semi-colon. Class definitions must always be followed with a semi-colon. The rest of your classes and all your constructors look okay.

Member Avatar for iamcreasy
0
161
Member Avatar for Graphix

I don't know WINAPI, so I can't help you with your syntax, but it sounds like you are missing a library file that the linker needs.

Member Avatar for Graphix
0
2K
Member Avatar for mimis

Do you know how long each line is and also how long the file is overall? If not, dynamic allocation will be required and the algorithm changes dramatically. For simplicity, and if allowed by your instructor, you may want to consider using a vector<string> instead of a 2-d array.

Member Avatar for Ancient Dragon
0
120
Member Avatar for SweetDeath

Are you getting any compilation or run-time errors? You really haven't given us much to go on. I will say, though, that this is not correct: [CODE]const int SIZE = 10; int anArray[SIZE] = {0}; for (int i = 0; i <= SIZE; i++) { /* ... */ }[/CODE] I …

Member Avatar for SweetDeath
0
115
Member Avatar for spartanace

Lines 55 and 96 of this post. Which one is wrong? [edit] Wait. Let me look again. I missed the specialization comment.

Member Avatar for mrnutty
0
159
Member Avatar for drt_t1gg3r

[QUOTE] [CODE]int main(){ SOME_TYPE* list[5]; list[0]->SetName("one"); list[0]->SetValue(1); list[1]->GetName("two"); list[1]->SetValue(2); DisplayList(list); return; }[/CODE][/QUOTE] This is okay, except that Line 5 should be a call to the SetName() method, not the GetName() method, also see note(s) below concerning DisplayList()... [QUOTE][CODE]void DisplayList(SOME_TYPE* list){ for(int loop = 0; loop < 5; loop++){ if(list[loop] != …

Member Avatar for drt_t1gg3r
0
186
Member Avatar for programing

[QUOTE=Aranarth;1227106]string is included by iostream, so you can just omit the include and still use strings.[/QUOTE] That is not always true. It is far better to be explicit. There is less chance for an issue.

Member Avatar for NP-complete
0
150
Member Avatar for sharensla

[QUOTE=corby;1228477]dont matter. same thing its like sayin a*b versus a * b....its the same thing except for where the space is. the compiler wont care for a space in that situation[/QUOTE] This is relevant to the OP and the previous post's questions how??? This: [CODE]int* a, b;[/CODE] Is not the …

Member Avatar for Fbody
0
2K
Member Avatar for Sandhya212

Also, I notice you only have [CODE]#include "distribution"[/CODE] if daviddoria's suggestion doesn't help, try adding a ".h" to the name i.e.: [CODE]#include "distribution[B][COLOR="Red"].h[/COLOR][/B]"[/CODE]

Member Avatar for Sandhya212
0
162

The End.