537 Posted Topics
Re: here was my attempt at writing tic-tac-toe maybe it will give ye' some ideas: [url]http://flashdaddee.com/forum/showthread.php?t=50[/url] | |
Re: Learn the basics of windows programming [URL="http://www.winprog.org/tutorial/index.html"]http://www.winprog.org/tutorial/index.html[/URL] | |
Re: Here is one easy method: [code] for(int i=0; i<People.size(); i++) { if(People[i].name == target) { cout << "Person Found: " << People[i].name << People[i].street << People[i].city << People[i].zip ; } }[/code] | |
I need a little help calculating odds for a roulette game.. i'm not sure why someone would bet 1:1 odds.. to me, that just means you win your money back without making a profit. also, 1:1+bet back doesn't seem any different than betting 2:1.. this is how I calculate it: … | |
Re: [code] #include<iostream> #include<string> using namespace std; string char_to_string(char source[]); int main() { string full_name; char first_name[20]; char last_name [20]; cout << "\n\nEnter First Name: "; cin.getline(first_name, 20); cout << "\n\nEnter Last Name: "; cin.getline(last_name, 20); full_name = char_to_string(first_name); full_name += " "; full_name += char_to_string(last_name); cout << "\n\n\nYour full name … | |
Re: You have done everything right thus far.. the only thing you haven't done, is to provide "function definitions" for your functions. Below your main( ), go ahead and right up what each function is supposed to do. Here is some pseudo to get ye' started: [code] void getData(menuItemType menu[]) { … | |
Re: have you created an object from your class? is "f" a public.. or private class member? ;) post ye' code and we can help more. | |
Re: According to [URL="http://www.cplusplus.com/ref/iostream/istream/getline.html"]http://www.cplusplus.com/ref/iostream/istream/getline.html[/URL], the two acceptable forms of cin.getline() are: [code] istream& getline (char* s, streamsize n ); istream& getline (char* s, streamsize n, char delim );[/code] Both versions expect a char pointer as the first argument.. not a string class object. Luckily, string class objects contain a method that … | |
Re: [quote] y = 5 + 2b; and gives out the output y = 5 + 2b[/quote] hmm.. this is wicked easy [code] cin >> expression; cout << expression; [/code] ![]() | |
Re: what code have you attempted thus far..? where are you encountering difficulty in writing this program? | |
I am writing a simple program.. enter first and last name and a search is performed.. and their phone number (if found) is returned. I have used vector class iterators before a couple of times.. but devcpp does not seem to like this code.. and stops compilation somewhere inside of … ![]() | |
I have an operator overloading question... I have attempted to overload the >> operator so I can read a file directly into a "SongInfo" object, and attempted to overload the << operator so I can display a "SongInfo" object directly to dos console. When attempting to compile, I recieve, "overloaded … | |
Re: To get ye' started, here is how to create an array and store the first 100 multiples of a number into that array (assuming that no number in the array exceeds the bounds of the datatype size int ) [code] int array[100] ; cout << "Enter a number: " ; … | |
Re: Here is one idea using the post increment operator: [code] int a, b; cout << "\nEnter first number: "; cin >> a; cout << "\nEnter second number: "; cin >> b; for (int i = 0; i < a; i++) b++; cout << "\nThe answer is: " << b; [/code] ![]() | |
Re: I think the theory behind using while loops in linked list traversal.. goes something like this: 1. check the head pointer... if(head_ptr) then x = head_ptr ; 2. now.. assign the head_ptr to x, x = head_ptr; 3. x now points to the first node of the list. 4. traverse … | |
Re: [code] struct Record { string title; int playtime; Record *next; }; Record **ListOfRecords = new Record*[42]; [/code] | |
Re: Here is a possible answer [u]without[/u] using a Class.. you can use the algorithm(s) below when you put together your class in your program. [code] #include <iostream> using namespace std ; int main() { int score[i], total = 0 ; for(int i=0; i<10; i++) { cout << "\nEnter an integer: … ![]() | |
Re: hmm.. try this: [code] for (cnt = 0; cnt < TOTAL; cnt++) { die1 = rand() % 6 + 1; die2 = rand() % 6 + 1; sum = die1 + die2; [b]++array[sum-2];[/b] }[/code] | |
Re: [code] else if (guess = num) [/code] should be: [code] else if (guess == num) [/code] | |
Re: [code] #include<iostream> #include<ctime> using namespace std; int main() { int number = 0, guess = 0; bool again = true; char answer; srand(time(NULL)); do{ number = rand()%3 + 1; cout << "\n\tGuess a number from 1 to 3: "; cin >> guess; while(again) { if(number == guess) { cout << … | |
Re: Here is one method you could use to sort your linked list alphabetically: (I haven't tested this specific code but the idea is sound) First, push each node into an array of nodes: [code] Node **array = new Node*[size]; Node *temp = head_ptr; while(temp) { Node[i] = temp; temp = … | |
Re: I had a little trouble with linked lists when I was learning.. so I whipped up a little something to get you started: [code]#include<iostream> #include<fstream> #include<sstream> #include<cstdlib> #include<iomanip> #include<cctype> #include<string> #include<windows.h> using namespace std; struct Node { string name; double cost; int quantity; Node *next; }; class Soda { public: … ![]() | |
Re: [code] class Fractions { public: //class constructor Fractions( ); //overloaded operators Fraction operator+(const Fraction &rhs); Fraction operator-(const Fraction &rhs); Fraction operator/(const Fraction &rhs); Fraction operator*(const Fraction &rhs); //other void print( ); private: int numerator; int denominator; }[/code] [u][URL=http://cplus.about.com/od/beginnerctutorial/l/aa101402b.htm]This[/URL][/u] is about all the help I can give ye' for now.. Above … | |
Re: [code]int blah (Treep *tree);[/code] I think the data type you are attempting to pass is incorrect.. you should be passing in an object of type, "node" [code]int blah (node *tree);[/code] please post compiler errors for more assistance. | |
Re: this program is wicked easy.. at least try to make an attempt on your own. | |
Re: This is what I am thinking... Your loop condition is based on a=1 and will increment while a < size()+1. [code] for(int a=1;a<(S.size()+1);a++)[/code] But my guess is.. your linked list is "zero based".. much like how an array is.. which would account for why all other elements would be deleted.. … | |
Re: C++ was invented by Bjarne Stroustrup, a professor at Texas A&M. It evolved from the C language.. and was originally referred to as, "C with Classes." The International Standards Organization now governs the c++ language. [URL=http://www.research.att.com/~bs/omo_interview.html]Here[/URL] is a good interview with Bjarne that will answer a lot of ye' questions. … | |
Re: free webhosting is good.. howev3r, I think that when it comes to the highest quality assignments done fast.. I think a nominal $$$ will get you what you want in this case.. ;) | |
Re: [QUOTE=atrusmre]Got anything a little easier? :)[/QUOTE] How about this: [code] #include <windows.h> #define ID_LIST 1 #define ID_TEXT 2 /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "ComboBox App"; int WINAPI WinMain (HINSTANCE … | |
Having troubles handling text from a multiline edit box.. the first part of this algorithm runs fine by itself.. the second part (highlighted in blue) runs fine as a DOS console project using 'char' data types.. but when I add it to this windows project (using TCHAR's) it distorts the … | |
Re: Is this your entire code..?? if so, it has some serious issues.. like missing header files.. and missing main( ) function... if not, you should always check to see if your file was opened correctly.. could use if( instream_object.fail( ) ) cout << "file open failure!"; also.. I have a … | |
Re: sounds like you are on the right track.. counting the number of spaces is probably the easiest way to calculate the number of words in a file.. but as you have already identified.. one could run into trouble if there are multiple spaces in between words.. so why not identify … | |
Trying my hand at extracting user entered data from a multiline edit box... my strategy is to first, get the number of total lines from the edit box.. and the length of each line from the edit box.. and create a dynamic 2D array that is NULL terminated at the … |
The End.