• Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About zychrias

  • Rank
  1. Function help for a begginner

    #include iostream using namespace std; int main() { int sum = 0; int num = 0; cout << "Please enter three integers: "; for (int i = 0; i < 3; i++) { cin >> num; sum += num; } cout << "\nYour sum is: " << sum << "\n"; return 0; } that to me just seemed much easier then everything else...
  2. reading a line at a time

    it would be in ur text file have both a MAX LENGTH of each line and a terminator character Most people generally use the \n or \0 characters The terminator is used when the line is shorter then MAX LENGTH other then that you always know each line can be MAX LENGTH I'll review ur code u just posted...
  3. reading a line at a time

    Here's very rough idea that may help you out: If you are inputing a specific number of characters to a line. Say this number is 24. Are you ending it with a '\n' (newline) character? If say you want line 34. File seek until you hit the 33rd '\n' character, then continue on the next line? Very rough but if you posted code we could probably see how you're doing it at the moment.
  4. In my Google, Gamedev.net, and in books I've seen the only difference between Struct and Class is the private and public modifiers. What am I asking is if there are any other differences such as memory requirements and the usual noticable differences in how they are laid out?
  5. AI Semester Project Ideas

    I agree with the mod on learning the game Go. The added benefit of working with a teammate would always help out enormously. It's always easier to get multiple ideas when working on a fairly busy project.
  6. if I remember correctly SOCKET is of type (unsigned int) EDIT: Straight out of Winsock2.h /* * The new type to be used in all * instances which refer to sockets. */ typedef u_int SOCKET;
  7. Planes and Axis

    In case other readers are lost... The usual high school taught form of line intersection is the following: Y=MX + B B = Y-Intercept M = Slope
  8. DOOM3's memory usage steadily increasing.

    Is this happeneing to your System RAM or your Video RAM? If it's just your System, check your Video RAM and see if it's doing the same thing.
  9. DOOM3 & Little Kids

    tell him that's what clowns do to people...
  10. Name my baby...

    Hey all, my first born is do in a few weeks, and I am curious about any other spellings of her name. In what ways of you seen her name spelled? I've seen many styles and we want to see what all there might be available. Alexandria Thanks All!
  11. When life gives you lemons

    collect everyone else's and turn it into a natural power plant...
  12. window-door

    Drill tons of holes in your windows and doors and you will never have that issue... $0.02 :) edit: btw you're describing the simple vacuum effect air creates.
  13. Rotation in Lesson 6???

    Quote:Original post by hphuc glRotatef(xrot,1.0f,0.0f,0.0f); glRotatef(yrot,0.0f,1.0f,0.0f); glRotatef(zrot,0.0f,0.0f,1.0f); The xrot, yrot, and zrot each individually control the speed at which your item rotates about each axis. As far as knowing which way they will rotate. Shut down each rotate function and only use one at a time until you can get a feel for which way they will turn. Hope this helps...
  14. Is there a better way...?

    2) I tried it, here's what I found out: When in a console (MSDOS) you can't just hit enter at the prompt for a number. So my problem I guess is how can I tell if someone just enters "-1" in specifically. If they hit ENTER or RETURN it just skips a line and waits for an input. That was a great idea though, I hadn't thought of the '\n' being passed to it before.
  15. Is there a better way...?

    Here is what I'm working off of: "Write a program that overloads a getnumber function. If you pass it a bool argument, that version of the function returns zero or one depending on whether the argument is false or true. If you pass it an int, that version of the program returns the value multiplied by itself." Teach Yourself C++ 6th Edition Page 67 Practice #2 Here is my code for the entire program: #include <iostream> short inches; bool yn; inline bool getNumber(bool); inline int getNumber(int); int main() { std::cout << "Chapter 3"; std::cout << "\nExtra Practice 2"; std::cout << "\n\nAre you looking for the measurement of the area in a square? (1=Yes 0=No) "; std::cin >> yn; if (getNumber(yn) == 1) { std::cout << "\nWhat is the measurement of one side of the square in inches? "; std::cin >> inches; std::cout << "\nThe area of your square is " << getNumber(inches) << " units."; } else { std::cout << "\nSorry this program is only for calculating the area of a square."; } } inline bool getNumber(bool b) { return (b ? 1 : 0); } inline int getNumber(int i) { return i * i; } Is there a different way that would work better to do the overloaded functions? Second question: "Write a function that accepts an int with a default function value of -1. If you call the function with no arguments, it displays a message to that effect. If you pass an argument of other then -1, the function displays the argument value." Teach Yourself C++ 6th Edition Page 67 Practice #3 The program written: #include <iostream> int anInt; bool question; void myFunc(int i = -1); int main() { std::cout << "Chapter 3"; std::cout << "\nExtra Practice 3"; std::cout << "\n\nDo you wish to enter a number? (1=Yes, 0=No) "; std::cin >> question; if (question) { std::cout << "\n\nPlease enter a number: "; std::cin >> anInt; myFunc(anInt); } else { myFunc(); } } void myFunc(int i) { if (i == -1) std::cout << "\nERROR...Nothing new entered..."; else std::cout << "\nGood job, you got it right! Here's your number: " << i; } [\source] If the user enters -1 it does what the question asks it to do. Is there a way to check to see if NOTHING was passed to the myFunc() in general? In this way getting rid of the possibility that the user will enter -1? Thank you all in advance for your advice and help. [Edited by - zychrias on August 20, 2004 2:33:13 AM]