6,741 Posted Topics

Member Avatar for gregg21

Do you honestly think that somebody is going to download a RAR file (possibly also installing a program that recognizes RAR files if they don't have it), extract your source from it, compile, link, run, debug, and tell you what to fix so that you can tell your friends that …

Member Avatar for bombe
0
103
Member Avatar for mattcplusplus

>hope this helps. It doesn't. First, <math.h> isn't a valid C++ header anymore. Second, the correct header, <cmath>, has nothing to do with the .NET framework.

Member Avatar for Glued
0
120
Member Avatar for geegoo!

[url]http://www.nist.gov/dads/HTML/littleOnotation.html[/url] Knock yourself out, and don't start two threads with the same question.

Member Avatar for Narue
0
38
Member Avatar for ibassplayer205

>It is far better paractice to only include those symbols that you definitely want. Yes, though for such a small program it really doesn't matter. Namespaces don't become useful until you start working on projects with code from multiple sources (such as third party libraries). Up to that point, namespaces …

Member Avatar for Narue
0
175
Member Avatar for potential

You could pause after a certain number of results have been displayed, or write to a file and let your file reader handle the issue of scrolling. If you really want to do it yourself, and you want to use a console mode program, then you need several things: 1) …

Member Avatar for potential
0
114
Member Avatar for MissSneakyPaws

This doesn't sound like a programming or software design issue. You didn't even bother to mention what browser you use. They're all different you know. Since you're somewhat clueless, I'll assume Internet Explorer. Go to Tools, then Internet Options, then Clear History. >Basically i need to set on my computer …

Member Avatar for vegaseat
0
197
Member Avatar for os008

>he said that all who took the source compiled it But did he say how many [b]successfully[/b] compiled it? :cheesy: >and y is he commenting important parts, this is not normal! I wonder if you know what's normal and what's not to begin with. There are quite a few good …

Member Avatar for os008
1
237
Member Avatar for kloony

>Error: Unresolved external '_EDGE' referenced from C:\Graph\Test1.OBJ That's a linker error. It's telling you that you declared and used the name _EDGE somewhere in the program but neglected to defined it. When it comes to linker errors, the source files will compile, but they can't be linked together nito an …

Member Avatar for kloony
1
186
Member Avatar for jonnie83

[code] string search; getline(cin, search); string line; while (getline(file, line)) { if (line.find(search) != string::npos) cout<<"Found!"<<endl; } [/code]

Member Avatar for Narue
0
63
Member Avatar for Sukiebaby

[QUOTE=BinaryMayhem]there is an even better way to do that. after you compile the program for the first time, find the exe it creates. Right click the exe, click properties, click the program tab, uncheck the box "close on exit". then click apply! turning that off will leave the DOS window …

Member Avatar for evilsilver
0
249
Member Avatar for seeplusplus

>in C++ that's not allowed Are you sure? Maybe you should double check. It's allowed, though not very common because declaring a local structure restricts the scope of that structure to the function. That limits its usefulness. >is this program i wrote so far going to store all the data …

Member Avatar for Dave Sinkula
0
153
Member Avatar for Foxtildawn
Member Avatar for Narue
0
162
Member Avatar for {{unknown}}

[QUOTE={{unknown}}]UP UP :sad: :sad: :sad: :sad: :sad:[/QUOTE] Bumping is considered bad form. I, and anyone who agrees, will now proceed to ignore you for the life of this thread.

Member Avatar for {{unknown}}
0
199
Member Avatar for Yakface

Start by reading the key: [code] #include <string> std::string key; std::getline(fin, key); [/code] Then work your way through each of the records: [code] while (true) { int n = 0; // Number of correct answers // Scores first for (std::string::size_type i = 0; i < key.length(); i++) { char tf; …

Member Avatar for Yakface
0
104
Member Avatar for vegaseat

>Why are the standard header files in C++ so non-standard? They are standard and well defined. >Particularly iostream seems to be the most dialectal. Any compiler is allowed to provide non-standard extensions. Any issues you have with extensions are your problem.

Member Avatar for vegaseat
0
146
Member Avatar for Tresa

>1) the difference between getline and gets(). gets is a throwback from ancient C, is impossible to use safely, and should never be used in C++. getline is okay because you can supply a limit for how many characters to read. >2) why sometimes when getline is used along with …

Member Avatar for Tresa
0
103
Member Avatar for cricket

>if you then just press enter at the character search prompt you will find the \n. That's reasonable (and expected) behavior. Let's say you want to test for exceptionally long lines: [code] while (fgets(buffer, sizeof buffer, stdin) != NULL && !check(buffer, '\n')) { /* Append buffer to a dynamic string …

Member Avatar for vegaseat
0
161
Member Avatar for dallin

>Spend some time with your editor to look at the iostream header. Spend some time with the C++ standard. iostream isn't required to include cstdio or stdio.h, so your code exhibits undefined behavior. >The one that comes with Dev-C++ Not everyone uses Dev-C++.

Member Avatar for vegaseat
1
5K
Member Avatar for Foxtildawn

If you're going to do using namespace std, put it immediately after your includes. As it is, you're using ifstream and ofstream without qualifying the namespace.

Member Avatar for Narue
0
190
Member Avatar for Programming sta

Pick three random viruses and figure out a way to find them through their signatures. The first task is one of research.

Member Avatar for pajac
0
119
Member Avatar for H4_Extreme

First you have to include the standard header for students such as yourself: [code] #include <Imalazybastard> [/code] Then you need to call the following function: [code] do_everything_I_want_by_reading_my_mind(); [/code] That should get you started. :)

Member Avatar for jwenting
0
124
Member Avatar for rpgplyrff8

>while ((product = cin.get()) != EOF) Change this to: [code] while (cin>> product) [/code] And remove the first request for input outside of the loop.

Member Avatar for Narue
0
129
Member Avatar for crq

First, place this after your includes: [code] using namespace std; [/code] Then look for typos. Recompile and we'll go from there. p.s. It couldn't hurt to read my reply to your other thread. Notice how I used T(), not T, for default construction of a value of template parameter type.

Member Avatar for Narue
0
191
Member Avatar for tat2dlady

>How would you open the array of files or write to the array of files? Show us your code. What you're doing sounds very tricky and error prone. I'd like to make sure that you're doing it right.

Member Avatar for tat2dlady
0
125
Member Avatar for crq

[code] void IntArray:: init ( const T *data, int sz) { assert( (0 <= sz) && (sz <= MAXINT)); d_num_elements = sz; if ( 0 == d_num_elements ){ // if no elements in array d_array = NULL; // array points to NULL } else{ d_array = new T [d_num_elements]; } …

Member Avatar for Narue
0
223
Member Avatar for nicki7823

Remove unnecessary parts (ie. unrelated to your problem) from the program and then post it here. Many people are unwilling to download attachments because it's an inconvenience when most of the time we can tell you what the problem is at a glance.

Member Avatar for Dark_Omen
0
147
Member Avatar for kloony

>I am learning C while reading Robert Sedgewick's Algorithms in C (3rd Ed). Please do not follow the example code from that book. The concepts and descriptions are exquisite, but the code SUCKS! It's a poor translation from Pascal, with errors and bad style on every page. You would be …

Member Avatar for Narue
0
120
Member Avatar for mad_cow01

[QUOTE=mad_cow01]Hi i'm new here and tommorrow i'll be doing some project in computer science so i need a template/outline of a triangle.h file, thanks in advance ; )[/QUOTE] And you expect anyone to have a clue what you're talking about? triangle.h isn't a standard header, therefore it could be [b]anything[/b]. …

Member Avatar for 1o0oBhP
0
129
Member Avatar for trixiestrat

>I'm desperate, and it's due tonight. Sucks for you. I guess you should have paid attention in class. >I really don't know how I would go about doing that. You have a dollar amount. Subtract 20 until you can't anymore and count the number of times you subtracted 20. Then …

Member Avatar for Narue
0
143
Member Avatar for compeat

>but why this sample program doesn't work??!! Integer literals are just that, integers. If you want a long literal, suffix it with L. If you want an unsigned long literal, suffix it with UL. >void main(){ main returns an int, it always has and always will.

Member Avatar for Dave Sinkula
0
563
Member Avatar for mr_mooz

>it always seems to return 1 as a reult. I would imagine that's because both operands are non-zero. You're using the logical AND and logical OR rather than the bitwise AND and bitwise OR. The logical operators are && and ||, and the bitwise operators are & and |. >It …

Member Avatar for Dave Sinkula
0
212
Member Avatar for iseekknowledge

>if any one knows of an easier and/or different way please let me know An easier and different way is to just read all of the numbers and compare. At any given point it looks like you only need the current number and the previous number, and how much less …

Member Avatar for Narue
0
93
Member Avatar for softball4319

Three words: intermediate data structure. For example, read each record from the first file and save it in an array. Then sort the array and write it to the second file.

Member Avatar for Narue
0
26
Member Avatar for Asif_NSU

Option 1: Write your own functions to manipulate numbers represented as a string. Option 2: Use a library that does Option 1, such as [url=http://www.swox.com/gmp/]GMP[/url].

Member Avatar for Asif_NSU
0
185
Member Avatar for nico

>/* rand() is defined through the header math.h, as purpleposeidon said */ stdlib.h, not math.h. >The warnings don't prevent compilation but errors do! The warnings should be addressed though. They're there for a reason.

Member Avatar for arifilipe
0
3K
Member Avatar for sid3ways s13

>My teacher told me that tutoring was my problem and good luck basically You have a poor teacher. I suggest you report him, because he's not doing his job. >Anyone please please please help me. It may sound harsh, but some people just aren't cut out for programming. >Can some …

Member Avatar for alc6379
1
956
Member Avatar for BIT_SAIKAPIAN

>I have set a goal of 6 months to do best learning c++ and java So in 6 months you expect to learn both C++ and Java to the point where you could use them professionally? Answer me this: What experience with programming do you already have?

Member Avatar for jwenting
0
116
Member Avatar for crq

1) No, and maybe. 2) Say that the parameter shouldn't be changed and say that the method won't change the state of an object. 3) Yes, but only for objects that aren't dynamically allocated. For dynamic allocation, the destructor is called when the memory is released. 4.1) Close enough. 4.2) …

Member Avatar for 1o0oBhP
0
157
Member Avatar for inderjeet singh

>What should should i adopt to achieve my goal. Use the Win32 API instead of trying to break your computer with ASM. Specifically, look up SetConsoleCursorPosition on MSDN.

Member Avatar for 1o0oBhP
0
134
Member Avatar for Acidburn

>Can anyone point me the direction of getting a linux verision that comes with a .cpp compiler? g++ comes standard with every Linux distro I know of.

Member Avatar for kc0arf
0
188
Member Avatar for crq

[code] // Class.h class C { int i; public: C(); public: int geti() const; }; [/code] [code] // Class.cpp #include "Class.h" C::C(): i(0) {} int C::geti() const { return i; } [/code] [code] // main.cpp #include <iostream> #include "Class.h" using namespace std; int main() { C c; cout<< c.geti() <<endl; …

Member Avatar for crq
0
813
Member Avatar for dazednconfused

Okay, what's your exact problem? I've already been kind enough not only to refrain from flaming you for posting in the [b]wrong forum[/b], but also to give you a viable solution to your last problem. I don't have a great deal of patience, so I highly recommend moving your thread …

Member Avatar for dazednconfused
0
141
Member Avatar for dazednconfused

Keeping it simple: [code] using System; class City { private string name, state; private long population; public City(string name, string state, long population) { this.name = name; this.state = state; this.population = population; } public void relocate(string name, string state, long population) { this.name = name; this.state = state; this.population …

Member Avatar for dazednconfused
0
158
Member Avatar for crq
Member Avatar for Narue
0
154
Member Avatar for crq
Member Avatar for Narue
0
124
Member Avatar for crq

[code] #include <iostream> using namespace std; class IntArray { public: IntArray ( int sz = 10 ); IntArray ( const IntArray &x); virtual ~IntArray(); int size () const; int &operator [] ( int i ) const; private: int d_num_elements; int *d_array; private: void init (const int *x, int sz); }; …

Member Avatar for Narue
0
155
Member Avatar for cutenature

>The strcpy is valid. I was unaware that indexing an uninitialized pointer and then passing the contents of it (another uninitialized pointer) to strcpy was valid. Since I trust my knowledge more than I trust your knowledge, I'm going to say that you're wrong. >The question is how to free …

Member Avatar for Chainsaw
0
102
Member Avatar for oldroad

[code] #include <algorithm> #include <iostream> #include <vector> using namespace std; template <typename T> inline T mid(const T& a, const T& b, const T&c) { T init[3] = {a, b, c}; vector<T> v(init, init + 3); sort(v.begin(), v.end()); return v[1]; } int main() { cout<<"The middle number is "<< mid(12, 14, …

Member Avatar for oldroad
0
1K
Member Avatar for Tester2

This will work until you try to do just about anything else. [code] #include <iostream> using namespace std; template <typename T> class Complex { protected: T real, imag; public: Complex(T real_init, T imag_init) : real(real_init), imag(imag_init) {} public: template <typename U> friend U get_real(Complex<U>& c); template <typename U> friend U …

Member Avatar for Narue
0
284
Member Avatar for xxraveteddyxx

>how do floating numbers work exactly There's an [url=http://cch.loria.fr/documentation/IEEE754/ACM/goldberg.pdf]ebook[/url] out there that describes floating-point in detail. It's also over 40 pages of densely packed gibberish. Do you want to be more specific so that I don't have to summarize [b]everything[/b]? >i cant seem to understand there purpose They're useful if …

Member Avatar for Narue
0
80

The End.