1,358 Posted Topics

Member Avatar for kunal2020

I'm afraid we can't really give you project ideas because we don't know you or your abilities. All you can really do is keep your eyes open and pay attention to what you're working on. Then, if you notice something that you could make simpler to do by writing a …

Member Avatar for Celtrix
-1
114
Member Avatar for johnray31

What IDE are you using? I use VS 2008 Pro and I get the same thing when I try to inline in the *.cpp file. I don't think VS can do it. There must be something about how it interprets the inline keyword that messes up the linker. EDIT: Did …

Member Avatar for Fbody
0
309
Member Avatar for gilly231

Please post some code. We have no way of knowing what is happening if we can't look at the relevant portions of your code.

Member Avatar for gilly231
0
151
Member Avatar for tshepomaz

We really can't give you specifics. We don't know you, your abilities, or your interests. We could literally make hundreds of suggestions but all it is is an exercise in futility, and they are of no value, if they don't suit your interests and/or abilities. You say you "got the …

Member Avatar for tkud
0
91
Member Avatar for petmol

Do you see the numbers in parentheses in the errors? Those are Line numbers. The first three errors are flagging Lines 31 and 34. Here are lines 29-34 of your code, for reference:[CODE] /*29*/ bool again = true; /*30*/ do; /*31*/ { /*32*/ showMenu() // Visa menyalternativ /*33*/ /*34*/ cout …

Member Avatar for VernonDozier
0
209
Member Avatar for logicslab

I've read the book as well. It tends to cover a lot in a hurry, sometimes without adequately explaining the underlying theory. A reference is like a pointer, it is not as powerful, but can be both very useful and very dangerous at the same time, which this code demonstrates. …

Member Avatar for Fbody
0
133
Member Avatar for Akill10

What are your errors? It's hard to get very specific without that information. At first glance, though, I can see a couple things that should be addressed. [list=1] [*]You have not terminated your class declaration with a semi-colon. When you don't, it confuses the compiler. [*]You can't initialize a member …

Member Avatar for Akill10
0
139
Member Avatar for Jelte12345

I doubt it's a problem with [B]your[/B] code since it runs properly in Debug mode. Is there a section of code in your program that deals with either localization, dates or times? It may be a good idea to post that section for review and comment. It's also possible, depending …

Member Avatar for Jelte12345
0
163
Member Avatar for exekiel101

When troubleshooting, you should always address the first reported error first. The first error says[QUOTE]D:\12-22-10\jhyjhjkh.cpp(22) : error C2447: missing function header (old-style formal list?)[/QUOTE]This error refers to the header line of this function:[CODE] int Large(int Array[],int N, int& Big);{ int Big = 0 for(N=0,N<10,N++;){ if (Array[N] > Big) Big= Array[N]} …

Member Avatar for Fbody
0
219
Member Avatar for Akill10

You are correct. When you create an independent block, such as that in Lines 4 - 7, the variables are local to that block. Any variable that is created within that block goes out of scope and is destroyed when the block ends, unless it was dynamically allocated. Alarm bells …

Member Avatar for Akill10
0
136
Member Avatar for staz

First, you need to get the size of your array right. A 20x20 array of char doesn't hold 24 strings. It holds 20 strings that are up to 19-char long.

Member Avatar for Saith
0
238
Member Avatar for knotholaze

[URL="http://www.cplusplus.com/reference/iostream/manipulators/fixed/"]Use the "fixed" stream manipulator.[/URL] [CODE]#include <iostream> using namespace std; int main() { const double PI = 3.14159265; cout << fixed << "The value of PI is: " << PI << endl; return 0; }[/CODE]

Member Avatar for knotholaze
0
108
Member Avatar for jimJohnson

I suggest you think about coding as being a lot like putting together a puzzle. First you assemble the edges/frame, then you fill in the middle until you get the final image. During the process, you need to make sure that every piece you add works with the rest of …

Member Avatar for Narue
0
92
Member Avatar for vanalex

There's not much here to work with. It may be beneficial to post more of your code. A few questions for you to think about/answer (in no particular order): [LIST=1] [*]How is "changeAmount()" defined? [*]Is "K" a constant or a variable, and is it visible to both classes? [*]Are you …

Member Avatar for vanalex
0
82
Member Avatar for gpta_varun

Maybe I'm confused, but isn't this an example of the assignment operator, not the copy constructor? Wouldn't the copy constructor be more like this:[CODE]Class A { ...... }; main () { A * obj_1=new A(); // Next the obj_1 variables are initialized //Make a copy of obj_1 A * obj_2=new …

Member Avatar for Fbody
0
162
Member Avatar for mrcpp

[B]>>I'm thinking about making the primes vector global, so I won't need to re-create it every time, but I don't think using global variables is very OOP-like. Any suggestions?[/B] I don't think I would worry too much about how "OOP-like" it is at this point; you're not really doing any …

Member Avatar for mrcpp
0
310
Member Avatar for zit1343

The problem isn't cin. It's your variable(s). Your variable "name" is a single char, it's neither a C++-style std::string nor a C-Style char array. It must be either of those 2 types to hold a person's complete name.

Member Avatar for Saith
0
152
Member Avatar for jackmaverick1

It is possible to invoke an object's Destructor, if you define your own, but it's not recommended because it's likely to cause errors when the object is actually destroyed. You're better off destroying the actual object. The Destructor will be automatically invoked for you as part of that process.

Member Avatar for jackmaverick1
0
1K
Member Avatar for crimes

I'm assuming based on your wording that your program is currently all procedural. Since it's currently working, I think separating it into header and implementation files would be a good organizational start. That would allow you to re-use your existing code, you would just be putting it in different files. …

Member Avatar for Fbody
0
149
Member Avatar for sahil1991

Don't have any e-books, [URL="http://www.cplusplus.com/doc/tutorial/structures/"]but this should help[/URL]. It's a C++ tutorial on how to build them. The next 3-4 pages cover a variety of custom data types that you can use.

Member Avatar for Narue
0
166
Member Avatar for Frederick2

What you are experiencing is the result of "[URL="http://en.wikipedia.org/wiki/Endianess"]endianess[/URL]" which is a system-specific behavior. However, most modern systems have a "little-endian" configuration. In a little-endian configuration, the right-most bit of a word represents the smallest value (i.e. 1). Thus, if you have a 32-bit int whose value is one (1) …

Member Avatar for Fbody
0
147
Member Avatar for alexchen

He did. What happens when (range == i)? How does your code recognize and address that situation? It doesn't, but it needs to.

Member Avatar for Fbody
0
165
Member Avatar for AmerJamil

Do you know how to copy from one array to another? You should, [URL="http://www.daniweb.com/forums/thread332892.html"]after your other thread[/URL]. All you need to do is take that solution and modify/expand it to fit this situation.

Member Avatar for AmerJamil
0
195
Member Avatar for sharifyboy7

The algorithm for displaying an array doesn't change from one scope to another. You already do it in your main() with your (what I will call) "preview" loops. All you have to do is replicate that structure in the appropriate location for where you want the array displayed. To make …

Member Avatar for Fbody
0
252
Member Avatar for AmerJamil

Well, you didn't specify what your problem is, but I suspect you are getting segmentation faults (crashes) at run-time. The problem is that you are only using "s" as the index of your arrays. If you have 2 arrays containing 5-elements each (elements 0-4). You are going to have memory …

Member Avatar for Narue
0
253
Member Avatar for harryhaaren

What about the vector class' built-in copy constructor? I don't know exactly how it works, but the STL is usually pretty quick...[CODE] vector<type> copyVector(originalVector);[/CODE] Or the built-in assignment operator?[CODE] vector<int> vecOne(10,0); vector<int> vecTwo(20,0); vecOne = vecTwo;[/CODE] Both of these, of course, would require the the dataType stored in the vector …

Member Avatar for Narue
0
4K
Member Avatar for icasta13

It's really not difficult. Your 3 files are className.h, className.cpp, and main.cpp. You would organize them as follows: [CODE]//Sample.h, the header file, contains class declaration #ifndef SAMPLE_H #define SAMPLE_H class Sample { private: int m_prvInt; public: Sample(); //default constructor void setInt(int); //"setter" }; #endif //SAMPLE_H[/CODE] [CODE]//Sample.cpp, implementation file, contains definitions …

Member Avatar for Fbody
0
116
Member Avatar for pretty_girl90

For one thing, you can't expect immediate responses to a forum post. Sometimes it happens, but that's not the norm, it usually takes a while. You bumped in less than an hour. [URL="http://www.daniweb.com/forums/announcement8-2.html"]Also, we can't just give you the answers, it's against forum policy.[/URL] If you would like help, we …

Member Avatar for jember
-1
141
Member Avatar for yakovm

Is this a "specialization" of an existing template for an int dataType? What compiler and OS are you using? Generally, when you are doing template programming, you want to keep your code as generic as possible. [CODE]template <typename T> T doubleValue (T inValue) { return (inValue * 2.0); }[/CODE] This …

Member Avatar for vijayan121
0
107
Member Avatar for christos312

Your for loops perform 5 iterations, they should only perform 4. Your loop should end at (arraySize - 1), not array size. This is incorrect:[CODE] const int arraySize = 5; int myArray[arraySize] = {0}; for (int i = 0; i <= arraySize; ++i) { myArray[i] = i * 2; } …

Member Avatar for christos312
0
154
Member Avatar for elsiekins

[B]>>Simmilar problem again using a vector of length 4[/B] Similar to what? What are you trying to do? If you're trying to pass a vector to a function, it appears that you have not defined your arguments/parameters correctly. To pass a vector to a function, you should define the parameter …

Member Avatar for elsiekins
0
145
Member Avatar for localp

What do you mean by "press the 'tab' button twice"? If you want to use a tab to push console output to the right a few lines, use the '\t' escape character.[CODE] #include <iostream> using namespace std; int main() { cout << "\t\tThis output is tabbed over..." << endl; cout …

Member Avatar for Fbody
0
11K
Member Avatar for alexchen

An int can store negative numbers that usually range from about -2.1 billion to about 2.1 billion. An unsigned int can only store positive numbers that usually range from 0 to about 4.2 billion. In a 32-bit system, an int is typically 32-bits long with the first bit being the …

Member Avatar for alexchen
0
208
Member Avatar for Nandomo

Well, the code is reasonably well formatted, but it's sort-of all crammed together in a single file so I'm having a little trouble following it. I can't address your problem specifically so perhaps an example will help:[CODE] #include <iostream> #include <cstdlib> struct Sample { int *pIntArray; int ArraySize; int UsedElements; …

Member Avatar for Fbody
0
216
Member Avatar for rgutierrez1014

It's because you are declaring the class [B]after[/B] you are trying to use it. As a result, the compiler doesn't know anything about the Node class yet. Rearrange your class' declaration so that Node is declared [B]before[/B] you use it. It's just like anything else, you can't use it until …

Member Avatar for rgutierrez1014
0
280
Member Avatar for johnloiebert

This reeks of a homework assignment, so I'm not going to provide any code at this time. FYI, this is the C++ forum, there is a separate C forum. Also, please use code tags when posting code in the future. They make the code in your post easier to read. …

Member Avatar for vinitmittal2008
0
130
Member Avatar for Dingbats

I can't find it at the moment, but there's a WinAPI tutorial out there that tells you how to build a window. In that tutorial, it has you do something with the window handle(s) that makes it possible to only open one instance of the program. If you try to …

Member Avatar for Dingbats
0
1K
Member Avatar for packetpirate

@OP [URL="http://www.cplusplus.com/reference/iostream/ios/clear/"]The function ios::clear() does not empty a stream[/URL]. If the stream is in an error state it resets the stream's error flags to return it to a usable state. You still need to empty the stream by another method such as istream::igmore(). This method appears to work. But unless …

Member Avatar for MosaicFuneral
-1
2K
Member Avatar for Syrne

[noparse]The glaring problem that I see is a lack of any connection at all between Checking/Savings and Account outside of the inheritance statement. You don't interact with any part of Account in either Checking or Savings. In an Object-Oriented system, generally it's okay for Derived objects (Checking/Savings) to be aware …

Member Avatar for Syrne
0
250
Member Avatar for DAlexNagy

I can't claim to be an OOP expert, I've only been studying it for a few months, but in my opinion, you're better off representing a physical object as a class. Each class you define should corerespond to the construction of one of your tables. You would then use each …

Member Avatar for DAlexNagy
0
169
Member Avatar for aquario20

Can't. Can't read your post. Please re-post with a better description of problem and use code tags then maybe we can help.

Member Avatar for Fbody
-3
131
Member Avatar for cclausen7

Yes, but you need to make sure to standardize your input format and institute some good error checking otherwise your user could really wreak some havoc with the application. How are you currently recognizing the "assign strength" command? If you're just using simple string comparison, you'll have to make some …

Member Avatar for Fbody
0
135
Member Avatar for bussa.forums

[QUOTE][CODE]int main() { HTTPClient* object=new HTTPClient(); object->SetUrl("http://developer.uidai.gov.in/auth/demoapp/9/9"); o->GetUrl(); o->AddEncodedPostField("input","test1.txt" ); o->Perform(); return 0; }[/CODE][/QUOTE] Where did "o" come from in Lines 5-7? Shouldn't it be "object"?

Member Avatar for Fbody
0
501
Member Avatar for myk45

>>Can anyone please help? Not unless you elaborate on the nature of the errors you are getting. Unless you share more information, all we can really do is take wild guesses. I don't think your getNode() is correct. I think you're missing a template argument in the line where you …

Member Avatar for griswolf
0
159
Member Avatar for darkace69

Is there a question in there somewhere? What are you having trouble with? I'm afraid I just can't figure out how to provide a valuable response to your query.

Member Avatar for darkace69
0
227
Member Avatar for dinners
Member Avatar for MairiRobertson

I've used both. I had to use Eclipse for a class that I took, but I use VS otherwise. The compiler Eclipse uses seems a little more "strict" than the MS compiler, but I don't really like the layout of Eclipse. IMO VS's layout is more intuitive and useful. I …

Member Avatar for mike_2000_17
0
163
Member Avatar for Suzie999

When using malloc(), you need to cast the return to the appropriate type of pointer. From your linked reference:[QUOTE][CODE]buffer = (char*) malloc (i+1);[/CODE][/QUOTE] Notice the "(char*)"? That's a type cast. You need to add them to this code. Whoever the original author of this was must have been relying on …

Member Avatar for Suzie999
0
229
Member Avatar for bufospro

I think you should clarify what you are trying to do. Either your example output doesn't match your example input making it not make sense or your description of the required actions is too cryptic. Example input Line 1: 20 20 1 5 6 Example output Line 1: 20 20 …

Member Avatar for bufospro
0
123
Member Avatar for kevintse

When a function returns a value, the return is stored temporarily so that the code that called the function can access it. This temporary value doesn't die until the calling code has used it. What you are experiencing with foo() is normal, your experience with bar() is not. Your definition …

Member Avatar for kevintse
0
129

The End.