Posts
 
Reputation
Loading chart. Please wait.
Joined
Last Seen
Ranked #4K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
57% Quality Score
Upvotes Received
4
Posts with Upvotes
4
Upvoting Members
4
Downvotes Received
3
Posts with Downvotes
3
Downvoting Members
3
4 Commented Posts
0 Endorsements
Ranked #3K
~12.4K People Reached
Favorite Tags

38 Posted Topics

Member Avatar for may4life

Hi guys, I'm quite new to C++, I have just recently gone through 3/4 of SAMS teach yourself C++ in 21 days and I am hoping to start programming my first object-oriented game. I have created a few games in the past (you can check them out on my site …

Member Avatar for Serapth
0
2K
Member Avatar for confused!

Here's a working example i just wrote. I've also used the enum type you guys were talking about, plus i added another of my own. Study this well and u'll c what i was going for. Hope it helps, byee [code] #include <iostream> #include <ctime> using namespace std; enum Choice …

Member Avatar for wizzard_tzie
0
656
Member Avatar for newbie2c++

Here's something that you might find useful. Because the description of the problem isnt really the clearest it could be, I made this little program up to help you understand what should happen. Its using a functino called DoMenu which displays the menu and gets input from there. [code] #include …

Member Avatar for vmanes
0
900
Member Avatar for dmmckelv

yep thats fine.. also make sure you return 0 when you declare int main(), otherwise declare void main() The final program should look like this: (I changed the name of the function perfect(...) to perfect_function(...) and i added a return 0 at the end of main) [code] #include <iostream> using …

Member Avatar for Nick Evan
0
1K
Member Avatar for myboo11009

Here;s something you can work on. It may not be exactly what you need but its a basis at least. Also, why do you need to check if the second number of the division is zero, from the second you say it will accept values from 1-20?? Anyway, I put …

Member Avatar for ithelp
0
1K
Member Avatar for may4life

Hi, can anyone tell me how to configure DirectX (December 2006) in MS visual C++ 6.0 please, or at least where or what to read to finally do it? I’m having a real hard time figuring this out thanks

Member Avatar for may4life
-1
65
Member Avatar for 80s

First of all, here is your code indented with some comments: [code] #include <stdio> //void triangle(int n); // function prototype does not match the declaration. should be: void render_triangle(int height); // or: void render_triangle(int n); int main() { int rowLength = 0; int rowHeight = 0; printf("\n Enter a number …

Member Avatar for Aia
0
498
Member Avatar for Boldgamer

I've read SAMS teach yourself C++ in 21 days and Herbert Schildt's C++ from the ground up. I honestly recommend the first one though as it's code is much clearer and easier to understand. The second book though goes more into the containers such as lists and vectors and as …

Member Avatar for may4life
0
169
Member Avatar for jessiegirl

You can just do this. It checks through all the elements in the array and finds out each check which is the smallest, biggest and average value of the array so far. At the end you have your results [code] #include <iostream> using namespace std; const int MAX = 10; …

Member Avatar for WaltP
0
160
Member Avatar for may4life

[I]<< This thread is split off from a discussion that originated here: [thread]62976[/thread] >>[/I] Here;s something you can work on. It may not be exactly what you need but its a basis at least. Also, why do you need to check if the second number of the division is zero, …

Member Avatar for jbennet
0
145
Member Avatar for jcflore3

You've got to understand you only need to be dealing with one instance of class Tollbooth. You declare 3 in your main! a,b,and toll. Just a hint, you dont need any parameters in your accessor functions! You can simply manipulate the variables cartotal and cash without any nums or num1s.. …

Member Avatar for may4life
0
231
Member Avatar for sunny123

It works fine on my compiler :-S Try declaring a boolean variable and have that in the while loop [code] bool keepLooping = true; ... while (keepLooping) { ... } [/code] Or simply use the forever loop [code] for (;;) { ... } [/code]

Member Avatar for John A
0
95
Member Avatar for Francis Waldron

I've commented out your mistakes and placed the correct bits where necessary. I also commented what you had wrong. Its mostly syntax errors, nothing too bad, just keep a eye out for these things. Also, always make sure your main() returns a 0. You had this code, but right down …

Member Avatar for iamthwee
0
171
Member Avatar for joelw

Yep, u need to use the index in your loop to make any sense of using it.. something like [code] for (index=0; index<NUM_PLAYERS; index++) { cout << "Name: " << players[index].name << endl; cout << "Number: " << players[index].playNum << endl; cout << "Score: " << players[index].Points << endl; } …

Member Avatar for may4life
0
189
Member Avatar for joelw

Here's a working solution. Ok what I did is: 1. Changed the sort algorithm from bubble to selection sort, passing the array in by reference. 2. Changed both sortArray and ShowArray functions to void, the needn't be double, they dont return anything. 3. Changed the count variable from 0 to …

Member Avatar for joelw
0
120
Member Avatar for gemacjr

[code] #include <iostream> using namespace std; void function(char *name); int main() { char string[20]; char *aString=string; function (aString); return 0; } void function(char *name) { cout<< "enter name: "; //cin >> name; cin.get(name,19); // so you can get more than one word in your string cout << name; } [/code]

Member Avatar for may4life
0
78
Member Avatar for Luckychap

Of my studying and understanding, Virtual Functions are used only for polymorphism. Use virtual functions ONLY if you know those functions wil be overloaded or overrided in derived classes. Don't make a habit of using virtual in any function because "you may need to overload it later on". Now, for …

Member Avatar for Ancient Dragon
0
140
Member Avatar for teddy13

An easier way of doing this is something like: [code] #include<iostream> #include<string> using namespace std; int main() { string myString = "momimom"; bool check = true; int i=0; int size = myString.size(); for (i=0; i<(size/2)+1; i++) { if (myString[i] != myString[size-i-1]) check = false; } if (check) cout << "This …

Member Avatar for may4life
0
107
Member Avatar for jessiegirl

This is one way of handling it. Study it and you'll get your head around it. Hope it helps byeee [code] #include<iostream> using namespace std; int main() { int input; int i; int value; int sum=0; // must be initialized with 0 cout << "How many numbers to enter?: "; …

Member Avatar for ~s.o.s~
0
97
Member Avatar for teddy13

Here's a working solution. Study it hard and youl'l figure it out. Hope it helps byeee [code] //This progam accepts marks of 4 different subjects by 5 students. //Then calculates the average score of each subject and displays the //result. #include<iostream> using namespace std; int main() { int value=0, i=0, …

Member Avatar for may4life
0
84
Member Avatar for AnG'

your code is fine man.. I enter 5 numbers (one for each type) and the output seems correct to me. Dont know what went wrong on your side?!?...

Member Avatar for manutd
0
116
Member Avatar for astrojith

int main() is used to return 0 at the end. This 0 is returned to the Operating system to denote that the function main() - which is the only function called by the operating system and that's why its so special - has completed successfully. Always use int main() and …

Member Avatar for chunkmartinez
0
496
Member Avatar for newbie2c++

I guess this problem is fixed. The final code should look something like: [code] #include <iostream> #include <iomanip> #include <string> using namespace std; // prototypes float division_input(string); void highest_division(float, float, float, float); int main() { cout << "This program written for cs102 Online." << endl; float nE=0,sE=0,nW=0,sW=0; nE = division_input("North …

Member Avatar for John A
0
192
Member Avatar for bokim

you can use system("cls") but that will clear the entire screen, not just a part of it. Beware that this is an OS command though

Member Avatar for WaltP
0
135
Member Avatar for dev.cplusplus

long integers also have a maximum value. They are made up of 4 bytes (32bits) (depending on each pc) and can only hold upto a certain number. If you try to go past this number you will wrap around and start at the beginning. Try using unsigned long int, which …

Member Avatar for dev.cplusplus
0
119
Member Avatar for Francis Waldron

Here's how its supposed to handle. Check it out and hope it helps [code] #include <iostream> using namespace std; int main() { int num1=0; int num2=0; int quotient=0; int remainder=0; cout << "first number entered: "; cin >> num1; cout << "second number entered: "; cin >> num2; if (num2==0) …

Member Avatar for Francis Waldron
0
321
Member Avatar for aznballerlee

This is how to implement your function. Check it out, hope it helps [code] int indexOfMin(const string a[], int n) // i'm assuming n is the number of { // elements in the array?? int min=0; // minimum of all strings if (n<0) // check if empty first { return …

Member Avatar for aznballerlee
0
115
Member Avatar for mattyd

I am guilty of this, I'll be honest. I know it is important to indent and indent properly, it is industry standard, and it is simply utilitarian. Well [URL="http://www.daniweb.com/techtalkforums/member121974.html"]sharky_machine[/URL] you're correct upto a point. Industry standard however depends on the industry and company you work for. "Good" indencing is not …

Member Avatar for vegaseat
0
323
Member Avatar for jimbobint

[code] int SomeArray[5][2] = { {0,0}, {1,2}, {2,4}, {3,6}, {4,8}} [/code] This creates a 2-dimensional array. All together this array has 10 elements. Which is the first index of this array? SomeArray[0][0]. The initialization states that this is equal to 0 (the first 0 in the {0,0}). Which is the …

Member Avatar for ~s.o.s~
0
161
Member Avatar for jcflore3

Here's the code. You dont really need the last two #includes in the program.. Not sure if you needed them for later though.. [code] #include<iostream> #include<iomanip> using namespace std; int main () { const int NUMROWS = 5; const int NUMCOLS = 3; int i, j, num = 0; int …

Member Avatar for may4life
0
301
Member Avatar for nithia

if you're using C++: 1st thing to do: [code]#include <fstream>[/code] 2nd thing open the file for output obviously if you're going to append and change the default behaviour of ofstream: [code]ofstream fout(<filename>, ios::app)[/code] Then go on with your program. Dont forget to close your file at the end!!

Member Avatar for may4life
0
91
Member Avatar for The Leprechaun

getline() throws away the \n null character at the end of a string and therefore makes a mess when trying to fluch the buffer. Using cin.get() makes everything much more comfortable

Member Avatar for may4life
0
87
Member Avatar for phuduz

OK what i did first of all is clear up your code.. Please start using spaces, ur killing us here! I simply sent in the check boolean variable into the IsValid function by reference. This clears up your whole program [code] #include <iostream> #include <string> using namespace std; void GetScore(double …

Member Avatar for may4life
0
82
Member Avatar for spacecowboy123

Yeah, integers wrap around themselves. For example if you had a signed (takes positive and negative numbers, i think the min is -32,000 something and max is 32,000 something), then when you get to that maximum number and add 1 it will wrap around and start from its min. If …

Member Avatar for may4life
0
89
Member Avatar for hui

Here's a working example of how to reverse a string using a function. Hope this helps, good luck! [code] #include <iostream> using namespace std; void ReverseString(char string1[], char reversed[]); int main() { const int MAX = 80; char string1[MAX]; char reversed[MAX]; cout << "Enter your string: "; cin.get(string1,MAX); ReverseString(string1, reversed); …

Member Avatar for may4life
0
288
Member Avatar for matrimforever

Here's the whole program in one file. If you want you can divide this code and include the files as needed. I've also included a menu loop so you dont have to keep on running the program again and again. Good luck! [code] #include using namespace std; class Counter { …

Member Avatar for may4life
0
254
Member Avatar for paradoxxx

Here's the code for a working solution i just made. What you do with the counters at the end is up to you though. Good luck! [code] #include <iostream> using namespace std; int main() { // counter is an int array containing a counter for each possible character // entered. …

Member Avatar for paradoxxx
0
141
Member Avatar for JS1988

Here's the code for the first problem: [code] #include <iostream> using namespace std; int main() { int num; do { cout << "Enter a number > 0: "; cin >> num; } while (num <= 0); for (int j=num; j>0; j--) { for (int i=1; i<=j; i++) cout << i …

Member Avatar for may4life
0
123