96 Posted Topics

Member Avatar for robgeek

[code] //function prototypes void rev_str(); double Mean(const int Data[5][4], int, int); void frequency(const int Data[5][4], int,int); // main int main() { . . . return 0; } // functions . . . [/code]

Member Avatar for Ancient Dragon
0
250
Member Avatar for Newguy89

Side note: You only need to seed the random number generator once to use it for the application. [code=C+] // . . . int main() { srand((unsigned)time(0)); // . . . } // . . . [/code]

Member Avatar for chococrack
0
86
Member Avatar for thinfineline

If you leave it as is, it will only perform 10 repetitions of the loop, including invalid inputs. Then you'd only get the first 10 - (number of errors) even integers in your summation. My suggestion is this: [code=C++] for (int ctr=1; ctr<=10; ) { cout<<"Enter a number"<<endl; cin>>num; if …

Member Avatar for chococrack
0
116
Member Avatar for shindog3

Wheres the closing brace for your main function? [code=C++] for (i=1;i<=blankCount; i++){ cout <<" \t"; } for(i=1; i <= totalDates; i++){ cout << i << "\t"; dayCount++; if (dayCount==7){ cout << "\n"; dayCount=0;} } [/code] Ok... so for instance April... the output looks like this: [code] I will display the …

Member Avatar for chococrack
0
186
Member Avatar for cerb63
Member Avatar for Freaky_Chris
0
98
Member Avatar for chococrack

I have three files (myClass.h, myClass.cpp, and main.cpp) [code] // // myClass.h #ifndef MYCLASS_H_ #define MYCLASS_H_ template <class element_type> class myClass { public: myClass(); ~myClass(); }; #endif /* MYCLASS_H_ */ [/code] [code] // // myClass.cpp #include "myClass.h" template <class element_type> myClass<element_type>::myClass() { } template <class element_type> myClass<element_type>::~myClass() { } [/code] …

Member Avatar for Alex Edwards
0
188
Member Avatar for dtaylor01

[code=C++] int score; char grade; // read in total score cout << endl; cout << "Enter total score (float, must be <= 100): "; cin >> score; if (score >= 85) grade = 'A'; else if (score >= 75) grade = 'B'; else if (score >= 65) grade = 'C'; …

Member Avatar for chococrack
0
248
Member Avatar for koman

wrap it in braces { blah } Also, in your if statement, I think you're missing an else? [code] if ( ( i == 2 ) or ( i % 2 != 0 ) ) { p = i; } [COLOR="Red"] else // ????[/COLOR] { for ( int j = …

Member Avatar for stilllearning
0
165
Member Avatar for guest7

delete Operator (C++): [url]http://msdn.microsoft.com/en-us/library/h6227113(VS.80).aspx[/url] Dynamic Memory: [url]http://www.cplusplus.com/doc/tutorial/dynamic.html[/url]

Member Avatar for Ancient Dragon
0
127
Member Avatar for LADY187

[code]inFile.open("C:\\hw_5-1_ext1.txt");[/code] C:\hw_5-1_ext1.txt must exist and be in the correct format. I ran this code with a file I created that looked like: 123456 100 77 88 55.1 654321 88 77 66 55 I saved the file to C:\hw_5-1_ext1.txt and compiled the program and it ran fine. [quote="Your Program Output"] Student …

Member Avatar for chococrack
0
107
Member Avatar for Avaviel

[code] int main() { int AccountNumber, loop, loopEnd; double InputBalance, MinimumBlanace, FinalBalance, CheckTopLimit; char AccountType; bool validAccount = false; ofstream fout; ifstream fin; fin.open("bankdata.nf0"); fout.open("bankdataout.nf0"); while (validAccount == false) { cout << "Please enter the amount of accounts" << "that will be updated for this month." << endl; cin >> …

Member Avatar for Avaviel
0
343
Member Avatar for robgeek

Does moving your function prototypes help? [code] // Hw-4_Bhasin.cpp : Defines the entry point for the console application. #include "stdafx.h" #include<iostream> #include<string> #include<cmath> void rev_str(void); double Mean(const int Data[5][4], int, int); void frequency(const int Data[5][4], int, int); using namespace std; int main() { char option; cout<<"\n Please choose from the …

Member Avatar for robgeek
0
134
Member Avatar for clutchkiller
Member Avatar for Balinor

You didn't seed the random number generator, so you're getting the same result everytime. [code] srand(time(0)); // Initialize random number generator. [/code] Oh and on a side note, I love your code. It's very easy to follow.

Member Avatar for Balinor
0
119
Member Avatar for panpanf
Member Avatar for DemonGal711
Member Avatar for oceanicblack

If it's the [B][I]instructions [/I][/B]you're having trouble with then allow me to assist you: You have to develop a decimal to binary function. The decimal number that will go into your function is the one which will be produced from using the given "binary to decimal" function. You have to …

Member Avatar for stilllearning
0
229
Member Avatar for u3mo

[code]while (answer=='Y'||'y');[/code] Is like saying "WHILE ANSWER IS 'Y' OR " "WHILE 'y'" <-- What's 'y'? Your while loop isn't terminating. I'm sure the myriad of if statements using this logic are failing too. Try this instead: [code] while(answer=='Y' || answer=='y') [/code]

Member Avatar for chococrack
0
114
Member Avatar for sladesan
Member Avatar for alin_yuhee

int main() to begin... more to follow... Does your compiler fuss at you for not having header files or anything? Ahh I see what the problem is.. the arch is stopping or getting too slow. Let me see if I can track it down. and the int main(void) still works …

Member Avatar for alin_yuhee
0
116
Member Avatar for Liszt

Here [a link](http://msdn.microsoft.com/en-us/library/aa384042) that gives a code example to: "create a task that is scheduled to execute Notepad on a weekly basis. The task contains a weekly trigger that specifies a start boundary, a weeks interval, and a day of the week for the task to start on. The task …

Member Avatar for Liszt
0
183
Member Avatar for JimD C++ Newb

[code][B]void[/B] BST<KeyType, DataType>::traverse(TraverseType traverseType, void (*visit)(DataType)) [/code] Also, what the above comment suggests, your function is declared as a void (which means it doesn't return anything) and you're attempting to stuff the information returned (nothing) into the variable result. Eliminate the result variable, or set traverse to a bool and …

Member Avatar for chococrack
0
128
Member Avatar for guest7

Did you declare a pointer without allocating memory? [code] type_of_var *p; p = new type_of_var; // allocate memory[/code] We're really completely in the dark without any code.

Member Avatar for ivailosp
0
89
Member Avatar for cerb63

1! = 1 2! = 1 x 2 = 2 3! = 1 x 2 x 3 = 2! x 3 = 6 N! = 1 x 2 x 3 x .... (N-2) x (N-1) x N = (N-1)! x N Could this help? A guess: [code] int theFact = …

Member Avatar for Salem
0
216
Member Avatar for NinjaLink

whoa [code]ifstream inData; inData.open("Unknown.txt");[/code] Try pulling that out of the for loop

Member Avatar for VernonDozier
0
109
Member Avatar for JoeRoss578

[code] #include <iostream> int main() { [B] [COLOR="Red"]using namespace std;[/COLOR][/B] // out of place int exercise[5], i; [B][COLOR="Red"]cin >> exercise[0];[/COLOR][/B] // is only entering one value for (i = 0; i < 5; i++) { cout << exercise[i] << endl; } return 0; } [/code] [code] #include <iostream> [B][I]using namespace …

Member Avatar for sidatra79
0
204
Member Avatar for NinjaLink

[B]numbers[insertItem-1] = insertItem; [/B] Does this mean if you insert, oh i dont know, "6432", it goes into numbers[6431]??? If it does I'd look at it again, because I don't think that's what you WANT it to do

Member Avatar for NinjaLink
0
414
Member Avatar for jammy's
Member Avatar for chococrack

Hi folks, my name is Blake. I live in Southern Louisiana and am currently a second year computer science student at the local university. I am flabbergasted from working on this current project and happened to find this website on a much needed break. Narue's signature is what caught my …

Member Avatar for rksurthi
0
128
Member Avatar for afg_91320
Member Avatar for JimD C++ Newb

[code] Data superStruct; superStruct.name = thatLastNameIRead; superStruct.address = thatAddressIRead; int mySuperKey = thatKeyIRead; myBST.insert(thatKeyIRead, superStruct); [/code] What is the question? You don't need to do anything to the other two inputs, they're strings already, which is what the struct's values are. Parsing refers to breaking something into parts, in general. …

Member Avatar for JimD C++ Newb
0
109
Member Avatar for alleycot

[code] #include <motivation.h> #include <drive.h> #include <dignity.h> using namespace omg; int main() { string whatAreYouThinking = "foppishness"; int numOfPeopleWhoWillHelpYou = 0; string typicalResponseToThis = "rofl"; big_Surprise(whatAreYouThinking, numOfPeopleWhoWilHelpYou, typicalResponseToThis) = goDoYourOWNhomework; return 0; } [/code]

Member Avatar for Ancient Dragon
1
266
Member Avatar for defychaos

That code yields: 3, 7 , 11, 15, 19, 23, 27, 31 ... I think you're on the right track though. I'm trying to figure this one out too.

Member Avatar for Lerner
0
343
Member Avatar for unk45
Re: help

Yep you only need it once for the entire program. Then just call rand() % 52 wherever you need it. If you're going to be doing a bunch of random numbers at a time, its a good idea to have it wait a bit before generating the next number.

Member Avatar for chococrack
0
103
Member Avatar for grisha83

[url]http://www.cplusplus.com/reference/clibrary/cstring/strcmp.html[/url] strcmp: Compares the C string str1 to the C string str2. This function starts comparing the first character of each string. If they are equal to each other, it continues with the following pairs until the characters differ or until a terminanting null-character is reached.

Member Avatar for grisha83
0
138
Member Avatar for JackDurden

[code=C++] template<class T> class snake; template<class T> struct node { T data; node *next; }; template<class T> class snake { // . . . private: node *start_ptr; // . . . }; [/code]

Member Avatar for Sci@phy
0
88
Member Avatar for hebehemonkey

If you've made your network private, you've got your network key plugged into your laptop I hope :X

Member Avatar for hughv
0
177
Member Avatar for Korg
Member Avatar for justinlake888

if (!Continue()) is the same as saying if (Continue() != true) is the same as saying if (not Y/y)

Member Avatar for stilllearning
0
114
Member Avatar for chococrack

[code] void myClass<temp_Type>::myFunction(myClass<temp_Type>* &firstClass, myClass<temp_Type>* secondClass) { } [call] myFunction(*this, &secondClass); [/code] I think I am fundamentally challenged on the "this" qualifier. I want to pass a pointer to the current object(ie the object I am calling the function from), but am stuck trying to pass the "this". Are there …

Member Avatar for Narue
0
280
Member Avatar for jeevsmyd

Follow this link and read up on ctime for MFC applications. Seems you just need to set up a time interval of some sort, (ie if the user twiddles thumbs for 30 seconds, just continue) [url]http://www.cplusplus.com/reference/clibrary/ctime/[/url] Also for developing small projects at home I find Bloodshed Dev++ to be very …

Member Avatar for Narue
0
172
Member Avatar for ShadowOfBlood

Look at line 13 [code] stop = num;[/code] Now ask yourself, "self, whats stop?" "a [I]character[/I]." "self, whats num?" "an [I]integer[/I]." Whats probably going down is that the the char (stop) is being assigned an integer, which in effect is tossing your loop off. Are you only interested in positive …

Member Avatar for ShadowOfBlood
0
2K
Member Avatar for DevC++4.9.9.2

62: ptr->item; what about it? 89. while(ptr->next !=NULL) figure out why in ptr->next never becomes null I'm betting on the problem being in your insert function.

Member Avatar for DevC++4.9.9.2
0
157
Member Avatar for terme22
Member Avatar for shiniboy

[code=C++] mean3(value1, value2, value3); [/code] Whats happening here is that your returned value has nothing to come back to. In other words, the function is executing but then the returned value (mean) is flying off into fairy world. Do what Denniz said, just adding a "cout<<" to the front, or …

Member Avatar for Sky Diploma
0
138
Member Avatar for GrimJack

She spoke more to idiot America, with a cheerful, emotionally charged, do-gooder attitude that people love. And its true that America votes for the best speakers, because psychologically we're stuck in a deferential society based on emotional response from debates and speeches. Like one of the previous posters said, Biden …

Member Avatar for sneekula
0
254

The End.