420 Posted Topics

Member Avatar for KimJack

There was a thread on another forum a few days ago about Linked Lists, give it a read, because the answers might help you. [url]http://cboard.cprogramming.com/showthread.php?t=78460[/url]

Member Avatar for MIGSoft
0
356
Member Avatar for avalloc

Have a look at this tutorial on functions; [url]http://www.cprogramming.com/tutorial/lesson4.html[/url]

Member Avatar for avalloc
0
85
Member Avatar for some one

Something tells me you've found someone else's code, and you're attempting to use it without having a clue what it actually does. I hope this isn't your homework ;) [QUOTE=some one] Studio\MyProjects\delete_v\delete.cpp(670) : error C2660: 'insertArc' : function does not take 1 parameters[/QUOTE]The compiler is telling you that you've called …

Member Avatar for Bench
0
267
Member Avatar for stallion88

[QUOTE=cscgal]<offtopic>When I was in school, I was hanging out in the Computer Science Student Lounge when a professor walked in to get a soda out of the vending machine. Then, he exclaimed he had this great idea to give the first year students a project with vending machines and we …

Member Avatar for Rashakil Fol
0
549
Member Avatar for neno14me

The answer is "that depends" - you have to think about how you want to go about making the program - there's no right or wrong answer, because it depends largely on how simple or complicated your program will be. Entities such as Mine or Board are fairly important to …

Member Avatar for iamthwee
0
538
Member Avatar for worms707

[QUOTE=worms707] I get the following error: error C2451: conditional expression of type 'std::fstream' is illegal [code] if (outf1) { char ans; [/code] [/QUOTE] You can't do that with a std::fstream - however, you [b]can[/b] do it with an ofstream or an ifstream. It appears from the variable name, that you're …

Member Avatar for Bench
0
1K
Member Avatar for frenzy44

Not without seeing how [I]emp[/I] or [I]firstname[/I] are declared. it would appear from the error that [I]emp[a].last[/I] is of type [COLOR="Blue"]int[/COLOR]. Can you post more complete code?

Member Avatar for Bench
0
198
Member Avatar for bsdpowa

[CODE]int main() { COseba novi; novi.setNumber(5,3); novi.Sestej(); novi.Izpisi(); [COLOR="Red"]COseba();[/COLOR]//::COseba(); novi.Izpisi(); return 0; }[/CODE] a lone call to the constructor won't do anything useful - a constructor call means a new object is created (and in the case above, the object is created, does nothing, then destroyed) change that line to …

Member Avatar for bsdpowa
0
144
Member Avatar for jack999

Ugh! There's no way on earth anyone is going to even try to look at that code - try to format it properly. the very least you can do is [B]not[/B] have it all on one continuous line.

Member Avatar for Dave Sinkula
0
129
Member Avatar for thare

an MS-DOS Program runs in DOS, and a Windows program runs in Windows. which one you create depends on your compiler and/or settings, but from a C++ perspective, there's no difference

Member Avatar for thare
0
128
Member Avatar for ghadahelal

look up <time.h> - it includes a data type time_t - however, that is only accurate to a second AFAIK. if you need anything more accurate, you'll need to create your own, or find a 3rd party library.

Member Avatar for Ancient Dragon
0
173
Member Avatar for lsu420luv

Do you mean have 2 different files simultaneously attached to one stream? No, that couldn't possibly work - how would your program know which file to read? You can, of course close one file, then reuse the same stream to open a different file - but if you need them …

Member Avatar for lsu420luv
0
166
Member Avatar for puppy

My mind-reading device isn't working today - what are you actually trying to do with the constructor? Construct a Staff object using an existing vector<Employee> ? Construct it using a single Employee object? Make a copy constructor..? Construct it using some other value..? Bear in mind that the syntax of …

Member Avatar for Bench
0
154
Member Avatar for tuannie

[QUOTE=tuannie]If I was to use && wouldn't that only work if all the information contain in the text file as to be a, b, c, and d for the if statement to run? [/QUOTE] No, you're reading the statement wrongly, that "if" statement says "If input isn't 'a', AND input …

Member Avatar for Ancient Dragon
0
158
Member Avatar for lulug76

This sort of boolean arithmetic is probably simplest with a recursive algorithm. for the integers, a and b.. Take a temporary 'carrier' number which records the result of [INLINECODE]a AND b[/INLINECODE] bit-shifted one place left. if the carrier evaluates to zero, the result of the calculation becomes [INLINECODE]a XOR b[/INLINECODE] …

Member Avatar for dubeyprateek
0
417
Member Avatar for crizzio

You can take advantage of the fact that you can rearrange a 3x3 grid so that all horz/vert/diag lines create a sum of 15 [CODE] 2 9 4 7 5 3 6 1 8 [/CODE] This gives you a much firmer ground to perform mathematical checks on lines, for both …

Member Avatar for Bench
0
111
Member Avatar for geez85

[QUOTE=Salem]3. [CODE]for([COLOR=DarkRed]int polygon[/COLOR] = 0;polygon < 3;polygon++)[/CODE] This doesn't compile - polygon isn't declared. Try to post what you actually compiled. [/QUOTE]was that a slip of the brain? or are you working in C90 mode today? :)

Member Avatar for geez85
0
109
Member Avatar for bg123

the STL has built-in functions which will help you with most of that, read up on vectors, and see how some of the overloaded operators for vector work. also, look at the <algorithm> header.

Member Avatar for Bench
0
178
Member Avatar for Dj Enjoi

the escape character for a backslash is simply \\ - however, as Ancient Dragon says, CD\\ (or indeed any system() call) is unsafe. IIRC, chdir() is part of windows.h or conio.h depending on your implementation - it's not a standard header, but it's certainly better than system().

Member Avatar for iamthwee
0
108
Member Avatar for Acidburn

[QUOTE=Acidburn]yeh it appears to be does it not?[/QUOTE]No, it's very wrong. string::find() is a function.. I very much doubt that line is doing what you expect. Also, "$" is not a char, it's a const char* - double quotes mean a null-terminated string, wheras '$' is a single char. Although …

Member Avatar for Bench
0
155
Member Avatar for bg123

Your SodaCan class needs a constructor to assign something to the private height and radius data members. eg, the line [CODE]SodaCan can(10,5);[/CODE]requires a constructor which looks like[CODE]SodaCan::SodaCan(int, int)[/CODE] Much in the same way that, for an library type, such as [I]std::string[/I] you can say [CODE]std::string s("Hello");[/CODE]which will initialise [b]s[/b] with …

Member Avatar for bg123
0
240
Member Avatar for tuannie

[QUOTE=tuannie]Can you provide me with another example working out so that I can use the example question and try get an understanding out of it and attempt on my quesion. Thanks in advance....[/QUOTE] You should really pick up Salem's point about decimal - Just imagine you're going back to infant …

Member Avatar for anupam_smart
0
211
Member Avatar for almared_6

[QUOTE=almared_6]ya that's ok with me, but how do I get a record with the smallest? That's the question that I'm trying to find an answer for.[/QUOTE]How would you do it in real terms? Imagine someone calling out bingo numbers, and you're looking out for the smallest. The first time he …

Member Avatar for Bench
0
140
Member Avatar for totalnewb++

[QUOTE=totalnewb++]Hello all, Thank you ahead of time if anyone answers this. I am new to c++ and am having some difficulty understanding my assignment. I wrote some code that does what the teacher has requested but according to her it does not utilize a function. I know that I have …

Member Avatar for destin
0
122
Member Avatar for grunge man

[QUOTE=grunge man]NOPE NOT BROKEN I DONT CARE IF I USE CORRECT GRAMER ONLINE AS LONG AS IT GETS THERE AND THE PEOPLE CAN READ[/QUOTE]There's no need to shout either. You might think that spelling & grammar are superfluous online, but if people have to first decypher your message to understand …

Member Avatar for grunge man
0
362
Member Avatar for jack223

What kind of partition function are you using? does "G" appear before "F" in the alphabet?

Member Avatar for Narue
0
210
Member Avatar for porterrj

A margin is just blank space around an object on a page (or a screen). Since your output goes from left to right, the only margin you care about is the left-hand margin... How would you add a margin of, say, 5 spaces to a text document in Windows Notepad..?

Member Avatar for Bench
0
175
Member Avatar for musicmancanora4

[QUOTE=musicmancanora4]if they type anything less then 0 or more then 12 its an error[/QUOTE] Are you sure about that? What month is zero? ;)

Member Avatar for Narue
0
133
Member Avatar for rio

Do you mean to say that 2 of the derived classes share a member which the 3rd one does not? If so, you probably need an intermediary derived class, which contains those shared member(s) (either public or protected) - and derive the 2 "related" classes from this intermediary class. eg, …

Member Avatar for rio
0
148
Member Avatar for Podge

[QUOTE=iamthwee]>Andy, >Great Web page, I actually looked at before you even responded. That's not me or MY website. I just like it cos it's kewl :lol:[/QUOTE] You're kidding right? That's an epilleptic's worst nightmare!

Member Avatar for Podge
1
202
Member Avatar for nexes300

[QUOTE=nexes300]I see, that would make sense I guess...*scratch* Now Im going to have to find some way to initialize them I guess. *sigh* Function calls....unecessary function calls....ugly.[/QUOTE] I assume that this is some kind of a lookup table? How about wrapping your map inside a class, and using the constructor …

Member Avatar for nexes300
0
532
Member Avatar for SiliconSpec

All this use of '\0' is very C-like ..There is a much better way using C++ strings (And by the way, ignore the use of <string.h> <iostream.h> and void main() ) C++ strings have a size() function which tells you how many characters are in the string. [CODE]#include <iostream> #include …

Member Avatar for iamthwee
0
1K
Member Avatar for jack223

Compile this code.. then try changing bits of it... what happens when you modify it to some of the scenarios given in your homework assignment..? [CODE]#include <iostream> using namespace std; class duck { public: virtual void speak() { cout << "quack"; } }; class swan : public duck { public: …

Member Avatar for jack223
0
183
Member Avatar for Tiffiney_v24

[QUOTE=iamthwee]If you spent the same amount of time doing your own homework as you do with other people's you wouldn't be using void main()[/QUOTE]I fixed your post ;)

Member Avatar for iamthwee
0
160
Member Avatar for degamer106

Your loop is trying to access outside the range of the array. Your array is size 5, that means, the elements are indexed by the numbers 0-4... yet your for loop says: [CODE]for (j = SIZE; j < i; j++) [/CODE]You need to loop from j=0 to j<SIZE also, you …

Member Avatar for degamer106
0
151
Member Avatar for perlsu

when you "free" memory, you are deleting the object which "temp" points to, you are not modifying temp itself. What you are left with is a dangling pointer which points to some undefined part of memory, which could contain absolutely anything. you should assign the value of NULL to "temp" …

Member Avatar for Narue
0
99
Member Avatar for jack223

If you're not sure about e() and f(), You probably need to ask a different question... such as "How many methods does an [b]object[/b] of class D have?" .. because then the answer is 4. :)

Member Avatar for Lerner
0
96
Member Avatar for vamsi.rgiit

Remember : every time you use the word "new" - make sure you also use the word "delete" (or better still, create a class which handles all the dynamic memory stuff).. at the moment, your program has got memory leaks! Also, change "void main()" into "int main()" (and, unless you're …

Member Avatar for Bench
0
92
Member Avatar for pete0

[QUOTE=pete0] [CODE] if (d <= 31 && d >= 1 && m <= 12 && m >= 1 && y <=2006) [/CODE][/QUOTE] This was the first problem I noticed. Put your individual comparisons inside brackets. Think of each comparison as an individual expression. [CODE]if ( (d<=31) && (d>=1) && (m<=12) …

Member Avatar for dubeyprateek
0
99
Member Avatar for mwo0002

Generally, your input.txt should go in the same place as your executable. If for some reason, this is causing you problems, or you do not know where the executable is, refer to the complete path of the txt file explicitly, for example, in DOS/Windows, you'd use [CODE]ifstream fin ("C:\\MyProgram\\input.txt"); [/CODE] …

Member Avatar for mwo0002
0
307
Member Avatar for Duke_0064

[QUOTE=Duke_0064]Hi, I'm new to this C++ stuff. So if anyone can help that would be nice. I have this program to generate a random number and a the user inputs a number from the keyboard to correctly guess the number that the computer randomly chooses. but the numbers are always …

Member Avatar for Duke_0064
0
107
Member Avatar for leedurr

It would help if you could paste the exact error(s) - Be aware VC++ 6.0 is out of date, I strongly recommend downloading a newer compiler before you do anything else. There is definitely more than just one error in that code! It looks to me like you are trying …

Member Avatar for Bench
0
234
Member Avatar for fitfool

"bool" is short for "boolean" - look it up in any dictionary or computer science website. in C++, [COLOR=Blue]bool[/COLOR] is a data type for an object which accepts only [i]true[/i] and [i]false[/i] (or, alternatively, zero for false, and non-zero for true)

Member Avatar for Bench
0
73
Member Avatar for musicmancanora4

[QUOTE=musicmancanora4]Hey guys i need to find out how many days there are in a particular month in a particular year. How can i start building an algorithm like that im having some trouble?[/QUOTE] Since there's no relation between the month and the number of days it contains, your best (portable) …

Member Avatar for Bench
0
88
Member Avatar for cczak

[QUOTE=iamthwee]You'll have to make a few ammendments though[/QUOTE] Maybe you could change "C++ is an object-oriented programming language" to "C++ is a multi-paradigm language which supports object-oriented programming" Or am I clutching at straws there? ;)

Member Avatar for Bench
0
170
Member Avatar for v_solid_snake

[QUOTE=server_crash]I can see how you might have one class and one 'driver' program, but I don't understand why you would want more than one class.[/QUOTE] My guess is that he wants one for roman numerals, one for Arabic numerals, etc. Maybe switching between the two using dynamic binding and inheritance. …

Member Avatar for Bench
0
447
Member Avatar for lsu420luv
Member Avatar for Lerner
0
412
Member Avatar for Scoobs

[QUOTE=Vagabond]// I'm A Noob but I hope this helps ~ any comments are welcome[/QUOTE] You [I]really[/I] need a new compiler. You're honestly not helping yourself by learning pre-standard C++ (And i'm afraid to say that pasting code like that won't help anyone else either. Even with the conio stuff removed, …

Member Avatar for Bench
0
129
Member Avatar for k.moorthy

[QUOTE=greizel]pls help me to write a program that will input a word or a sentence and display that youve inputted in a reverse form. if the word you entered is the same as the reverse one, "Palindrome" will be displayed. Otherwise,"NOt Palindrome"[/QUOTE] 2 Ways to do this - Either create …

Member Avatar for anupam_smart
0
163
Member Avatar for supes32

[QUOTE]we were introduced to classes as well. should I use a class node instead of a struct node?[/QUOTE] "struct" and "class" in C++ are actually the same thing with one very subtle difference - "struct" defaults to all members public, "class" defaults to all members private (use the public/private/protected keywords …

Member Avatar for iamthwee
0
208

The End.