- Strength to Increase Rep
- +11
- Strength to Decrease Rep
- -2
- Upvotes Received
- 133
- Posts with Upvotes
- 112
- Upvoting Members
- 66
- Downvotes Received
- 22
- Posts with Downvotes
- 18
- Downvoting Members
- 17
Have an AS in computer science... specializing in c++ and windows api. I am a machine gunner for the VA Army National Guard. I have a private pilot's license. I also like to play guitar. Also a fan of my hometown team, the washington redskins. I have…
- Interests
- Flying, programming, guitar
- PC Specs
- Gateway PentiumIV 400mhz bus 1gb DDRAM
537 Posted Topics
Re: I am intruiged with this assignment.. although it's been years since I balanced a chemical equation.. I would find this to be a fun challenge. You teach me how to balance chemical equations.. I'll give you some code. Start me off with something simple.. and I'll code you an answer … | |
Re: That looks like quite a time investment.. cool ascii art too. How long did all this take you..??!? ![]() | |
Re: when it took me 6 months to figure out how to add basic resources to a win32 project.... and going through 5 compilers just to change window background color, i knew this **** was just to messed up. i'm glad i stopped at just c++ or else i would be … | |
Re: one thing is ye' need to call srand() somewhere in order to seed ye' random number generator. I would load your entire text file into a data structure, line by line, and then get lines out of the data structure at random. [code] vector<string> text_file; int line_counter = 1; string … | |
Re: You declare main() to return an 'int' type... but nowhere do you have a 'return' statement in your main() function. [CODE] int main() { ... ... yadda yadda .... ... etc etc. .... ... ... return 0; }[/CODE] | |
Re: I'll show you what I'd do, maybe it will give ye' some ideas on how to handle ye' problem: 1. Get a sentence to translate from the user [code] #include<sstream> #include<string> #include<iostream> #include<cctype> cout << "Enter sentence to translate to pig latin: "; cin >> user_input;[/code] 2. Parse the sentence … | |
Re: main() is prototyped to return an int, but returns nothing. | |
Re: When testing for primes, you only need to test half the range: [CODE] bool is_prime = true; cout << "Enter a numeral: "; cin >> number; if(number == 1 || number == 3) { cout << "Number is prime."; exit(0); } for(int i=2; i<number/2; i++) { //If there is any … | |
Re: the program does what you want it to do so it can't be all that bad. | |
Re: just out of curiosity i am trying to measure the performance of my basic algorithm vs. your algorithm... but i am having a math problem; for some reason I cannot peform this division: [code] seconds = (end-start) / CLOCKS_PER_SEC; [/code] i viewed the value of CLOCKS_PER_SEC as defined in the … | |
Re: this will create 12 "computer" objects and open 12 .txt files: [code] ifstream computers[12]; for(int i=1; i<13; i++) { string file("comp"); file += itoa(i); file += ".txt"; computers[i].open(file.c_str()); if(!computers[i].is_open()) { cout << "\a\nError, file #" << i << " unable to be opened!"; cout << "\nFile may be been moved, … | |
Re: Here is a little something to get ye' started: [code] #include<iostream> using namespace std; ////////// User Defined Abstract Data Types //////////// struct Record { int quiz_1 ; int quiz_2 ; int midterm ; int final ; } ; class Grade_Calculator { public: void menu( ) ; void add_a_record( ) ; … | |
Re: [code] string lines[69]; int i=1; while(getline(infile, lines[i])) { i++; }[/code] | |
Re: Talk about resurrecting the dead on Halloween.. never seen a post this old get bumped to the top in a long time (this thread originated back in 2004!) | |
Re: [code] //Provides ability to write to the dos console (cin/cout) #include<iostream> using namespace std; int main() { int input = 0; cout << "Enter t or f: "; cin >> input; do{ if(input == 't') { cout << "True"; } else if(input == 'f') { cout << "False"; } else … | |
have fun with this game o' keno! post here with your highest winnings | |
Re: in my opinion, you should write functions that evaluate everything from royal flush to high card: //function prototypes bool is_royal_fush(hand[7]); bool is_straight_flush(hand[7]); bool is_4kind(hand[7]); bool is_full_house(hand[7]); bool is_flush(hand[7]); bool is_straight(hand[7]); bool is_3kind(hand[7]); bool is_2pair(hand[7]); bool is_pair(hand[7); int get_high_card(hand[7]); Some hands might qualify for several winning scenarios, so it is important … | |
Re: I'm just briefly looking at your code, but is there any case where the size of s[i] would be less than 2? if so, you'd then be subtracting 2 and passing a negative value to substr(): `tmp[i].ID=s[i].substr(1, s[i].size()-2);` furthermore, your starting position is '1', so is there any case where … | |
Re: //Dynamic 2D memory allocation float* matrix = NULL; float** userMatrix = new matrix*[10]; for (int i=0; i<10; i++) { *userMatrix[i] = new matrix; } | |
Re: > Quoted Text Herehello i am creating a tictictoe game , however i cannot get the program to check if the player has won or not . and produce a you have won message void win_check(char Map[10]) { //Row checks for(int i=0; i<10; i+=3) { if(Map[i] == Map[i+1] && Map[i+1] … | |
Re: [code] int get_tiles(int& length, int& width){return length * width}[/code] | |
Fun game for the raging compulsive alchoholic gambler, such as myself. Although the game may vary among casinos, the basic premise is the user picks 10 numbers out of 80. The computer will randomly draw 20 numbers out of 80. If you matched with any of the computer picks, you … | |
Re: i like agressive RrrRRraawwrrrrr..... | |
Re: One problem may be that [I]you never initialized [U]any[/U] of your variables.[/I] [CODE] //These could literally be any value. int n,x,i,j;[/CODE] Here you create a variable 'j', and make a whole bunch of loop conditions that are based on 'j'... 'j' could be anything...... [CODE] for([B]j[/B]=(2*[B]j[/B]-1);[B]j[/B]>0;[B]j[/B]--)[/CODE] | |
Re: if the EOF flag is set and it's giving you problems with seekg(), try clear()'ing the object and see if that works for ye'. | |
Re: i've actually looked up youtube videos to teach myself this somewhat complex topic... never actually studies flow systems. i got the basic concept and can do some simple examples. i am down with your code, but i am not down with flow systems. if we put our heads together we … | |
Re: int types do not support floating point decimal. try using double types, and if you desire a set precision, you can go even further and use float's. with your calculator application, it is possible to prompt the user for a desired precision, in which case you would use float types. … | |
Re: [quote]so can only search for the IDS_STRING part. How can I achieve that?[/quote] try a little somethin' like this: [code] vector<string> text_file; //load the vector........ //find substrings in your vector: for(int i=0, size=text_file.size(); i<size; i++) { if(text_file[i].substr("IDS_STRING") != string::npos) { //found } else { //not found } }[/code] [quote] I'm … | |
Re: I can give ye' some help with solving a quadratic equation in c++, but I have no help for ye' when it comes to MFC. I could even help you solve the equation symbolically as opposed to a close decimal approximation. | |
Re: it's pretty easy to do.. just compare the number you with every occupied element in the array. if it is not in the array, add to array. else, try again. | |
[code] #include <iostream> int main() { std::cout << "Merry Christmas Everyone!"; return 0; }[/code] | |
![]() | Re: not only do you want numbers 10 thru 30, you want unique (non-repetitive) numbers. so this is how ye' can go aboot' it: [CODE] int random = 0; int numbers[69]; bool is_included(int numbers[], int); srand(time(NULL)); for(int i=0; i<=amount_requested; i++) { //pick a random number in the range ye' desire random … |
Re: your assignment is very easy. i could write it in less than 5 minutes. please excerpt some sort of effort... peace out yo. | |
Re: Here is a c++ solution: [code] #include<fstream> #include<iostream> #include<string> #include<vector> using namespace std; bool is_label(string); bool is_operand(string); struct line_obj { string label; string opcode; string operand; }temp; vector<line_obj> text_file; string word; ifstream infile("inputfile2.txt"); if(infile.is_open()) { cout << "\aFile failed to open."; cout << "\nFile may have been moved, renamed, or … | |
Re: I think you'd have to first check to see if there are any possible moves your king can make... and then if the attacking piece is not a knight, you will probably have to check every other piece on the board to see if it can move anywhere inside the … | |
Re: [code] string s("augcuuaucaca"); string temp; int size = s.size(); int pos = 0; vector<string> list; do{ try { temp = s.substr(pos, 3); list.push_back(temp); pos += 3; } catch(out_of_range) { break; } }while(pos != size);[/code] | |
Re: you seem to be doing fine. do you need any help on any particular portion of your assignment..? | |
Re: what you are trying to do is suprisingly not that difficult. this type of ascii game will involve some simple techniques. in any animated ascii game, it's just a matter of clearing and re-drawing the screen. you will need simple collision detection to tell when you've hit the enemy. you've … | |
Re: in order to avoid repetition, you will have to push skills you have selected into an array, and compare the contents against future randomly generated skills. if skill has been used, try again. | |
Re: [icode]#include <string>[/icode] | |
Re: what i would do in this situation is read in the entire line using getline(), and then break the line down and store it as you desire. here is a possible pseudocode: 1) read in the entire line 2) based on your text file format, we can assume the first … | |
Re: [url]http://en.wikipedia.org/wiki/Tar_(file_format[/url]) | |
Re: [CODE] struct object { char beer; }temp_object; for(int i=0; i<69; i++) { temp_object.beer = value; my_vector.push_back(temp_object); } //now change it for(int i=0, size=my_vector.size(); i<size; i++) { my_vector[i].beer = another_value; }[/CODE] | |
Re: I tried to give ye' some guidance with pseudocode... but trying to explain the loop conditions and array indicies seemed to be awkward and would have only added to your confusion. So I will give you one free of charge. Give the other 2 problems a chance on your own … | |
Re: with limited knowledge of your problem combined with other generalities (such as your 'for loop') one guess i would make is that your loop condition in line #12 seems suspicious. since array elements are zero based, it is somewhat uncommon to see size-1 as a loop condition. this could cause … | |
Re: If ye' have a windows operating system ye' can do this: [CODE] include <windows.h> void set_console_size() { HANDLE hOut; SMALL_RECT DisplayArea = {0, 0, 0, 0}; //set x and y to whatever ye' want int x = 125; int y = 55; hOut = GetStdHandle(STD_OUTPUT_HANDLE); DisplayArea.Right = x; DisplayArea.Bottom = … | |
Re: you have the function [icode]double getInput(double[],int);[/icode] to accept a double array; however, in line #28 you are attempting to pass in a double var. one solution could be to overload the getInput() function so you would have a version of the function that would accept a double, and one version … | |
Re: i suspect the problem might be file i/o related; however, i do not see any file i/o at all. i suspect these operations occur in the getblock() function (and it's variants) but I am not sure. one thing i would recommend though, is if you are attempting to use a … | |
Re: since you have a known format with with data separated by white spaces, we can create an object to hold each line from the text file: [CODE] struct account { //string string char int double string string first_name; string last_name; char m_f; int age; double balance; string address; };[/CODE] Now … |
The End.