[QUOTE=thomasfn;32463749]Or you could look into glEnable(GL_SCISSOR_TEST) and glScissor(x, y, w, h).[/QUOTE]
Thanks. A scissor box is exactly what I'm looking for.
does anyone know any free C++ compilers?
[QUOTE=xxncxx;32464307]does anyone know any free C++ compilers?[/QUOTE]
GCC's g++.
If you're on windows, you can get GCC/MinGW bundled with Code::Blocks.
[code]import java.util.*;
public class Lab07D
{
int number;
int thous;
int huns;
double tens;
int ones;
public static void main(String [] args)
{
Lab07D lab = new Lab07D();
lab.input();
lab.process();
lab.output();
}
public void input()
{
Scanner get = new Scanner(System.in);
System.out.print("Enter a four digit integer: ");
number = get.nextInt();
}
public void process()
{
thous = number / 1000 % 100;
huns = number / 100 % 10;
tens = number / 10; // Everything is fine till here, Not sure where to go.
ones = number / 1;
}
public void output()
{
System.out.println(thous);
System.out.println(huns);
System.out.println(tens);
System.out.println(ones);
}
}
[/code]
Input should be: 4528
I need it to output like this,
[code]
4 thousands
5 hundreds
2 tens
8 ones
[/code]
Required to use modulus division.
What do?
[QUOTE=Phreebird;32464600]What do?[/QUOTE]
First, why is 'tens' a double?
Second, your process() routine doesn't look right to me at all. If you have a textbook, I suggest you review the modulus operator.
Forgot to change it back. And as for the book all i have is a pdf. I'm so confused.
[QUOTE=Phreebird;32465099]Forgot to change it back. And as for the book all i have is a pdf. I'm so confused.[/QUOTE]
For positive integers, modulus is the remainder of division.
You have the division right, you're dividing to reduce 'number' by the appropriate order of magnitude. However, your modulus is wrong. You want one digit in base-10. What do you divide by to produce remainders in the range 0-9?
[code]
thousands = number % 10000 / 1000
hundreds = number % 1000/100
tens = number % 100 / 10
ones = number % 10
[/code]
You were missing a zero. See:
4358 % 1000 = 358
358 / 100 = 3
therefore, hundreds = number % 1000 / 100.
Provided you use ints, otherwise you need round() before the assignment.
Edit: now [i]I[/i] was missing a zero! What witchery is this?
Oh my. Thank you both. Math isn't exactly my strong side.
these equations are all valid even with things like non-uniform scaling, right? I'm fixing up OpenTK's matrix classes and the invert method is about 100 lines long, this looks like it would be a handy in making it a LOT quicker...
[url]http://www.cg.info.hiroshima-cu.ac.jp/~miyazaki/knowledge/teche23.html[/url]
[QUOTE=robmaister12;32466534]these equations are all valid even with things like non-uniform scaling, right? I'm fixing up OpenTK's matrix classes and the invert method is about 100 lines long, this looks like it would be a handy in making it a LOT quicker...
[url]http://www.cg.info.hiroshima-cu.ac.jp/~miyazaki/knowledge/teche23.html[/url][/QUOTE]
Number of lines doesn't mean anything. Looks like OpenTK is using Gaussian or Gauss-Jordan elimination, which is pretty standard. I don't think there's a whole lot of room for improvement, but I could be wrong.
Hi. Im learning xcode/objective c. Basically I want to be able to either block the user's phone number or give them a new one (VERY much like gmail's talk feature).
Any ideas on how to do this? I don't care if the calling feature uses data or minutes, the user's real number needs to be hidden.
Thank-you very much.
-snip-
Figured it out myself while exploring visual studio.
[QUOTE=ROBO_DONUT;32468559]Number of lines doesn't mean anything. Looks like OpenTK is using Gaussian or Gauss-Jordan elimination, which is pretty standard. I don't think there's a whole lot of room for improvement, but I could be wrong.[/QUOTE]
I'm not that well versed in matrix math, it just looks like it's doing a lot more work than it needs to. Or rather the work doesn't look very much like what I'd expect to see, which would be just a bunch of multiplication and addition or subtraction.
For a Matrix3 class, could I just change the array at the beginning to a [3,3] array instead of a [4,4] one and change all the 4s to 3s when iterating or is it more complicated than that?
-snip-
I'm not sure if this is the right place but what is a good language to start off with to learn about programming games etc?
I can't wrap my head around this - i've read some c++ tutorials now, but how the fuck would i implement something as simple as [URL="http://developer.valvesoftware.com/wiki/Source_Server_Query_Library"]this[/URL] into my console application? Just drop the header and cpp files into the tree view on the left in visual studio and start using functions from them? :downs:
[QUOTE=DrogenViech;32471704]I can't wrap my head around this - i've read some c++ tutorials now, but how the fuck would i implement something as simple as [URL="http://developer.valvesoftware.com/wiki/Source_Server_Query_Library"]this[/URL] into my console application? Just drop the header and cpp files into the tree view on the left in visual studio and start using functions from them? :downs:[/QUOTE]
Download the headers and libs, show visual studio where they're stored and link with the libs.
However, judging by "I've read some C++ tutorials" you don't really know what you're doing yet so I'd recommend learning a bit more of the language first.
Anything i really wanna start learning now..
[QUOTE=Erasus;32472706]Anything i really wanna start learning now..[/QUOTE]
C# with XNA.
[QUOTE=Chris220;32472185]Download the headers and libs, show visual studio where they're stored and link with the libs.
However, judging by "I've read some C++ tutorials" you don't really know what you're doing yet so I'd recommend learning a bit more of the language first.[/QUOTE]
Yeah, pointers still have me stumped a bit - back to the drawing board i guess :saddowns:
[QUOTE=Erasus;32472706]Anything i really wanna start learning now..[/QUOTE]
Love2D, C++ with SFML, C with SDL, C# with XNA, Python with pygame, etc etc etc. There's plenty, just pick something that looks alright to you and go for it.
Would it be possible for a program to download a file from the internet directly to the RAM?
[QUOTE=leontodd;32475080]Would it be possible for a program to download a file from the internet directly to the RAM?[/QUOTE]
Of course, that is always what is happening.
I'm super super new at programming in general, and I'm doing c++. I'm making a tic tac toe game and this is the code I'm using the check to see if there is a winner (just winning via column or row. Not diagonally.)
Is there any way I can compress this code????
[code] iCheck = 0;
for (j = 0; j < BOARD; j++)
{
iCheck = iCheck + iaBoard[0][j];
if (iCheck == 3)
iWinner = 1;
if(iCheck == 30)
iWinner = 2;
}
iCheck = 0;
for (j = 0; j < BOARD; j++)
{
iCheck =iCheck + iaBoard[1][j];
if (iCheck == 3)
iWinner = 1;
if(iCheck == 30)
iWinner = 2;
}
iCheck = 0;
for (j = 0; j < BOARD; j++)
{
iCheck =iCheck + iaBoard[2][j];
if (iCheck == 3)
iWinner = 1;
if(iCheck == 30)
iWinner = 2;
}
iCheck = 0;
for (i = 0; i < BOARD; i++)
{
iCheck =iCheck + iaBoard[i][0];
if (iCheck == 3)
iWinner = 1;
if(iCheck == 30)
iWinner = 2;
}
iCheck = 0;
for (i = 0; i < BOARD; i++)
{
iCheck =iCheck + iaBoard[i][1];
if (iCheck == 3)
iWinner = 1;
if(iCheck == 30)
iWinner = 2;
}
iCheck = 0;
for (i = 0; i < BOARD; i++)
{
iCheck =iCheck + iaBoard[i][2];
if (iCheck == 3)
iWinner = 1;
if(iCheck == 30)
iWinner = 2;
}
[/code]
I've got a set of X, Y coordinates and I need to check which coordinates they are closest too in a list I have with lots of X, Y coordinates. I'm using Python, how exactly should I go about doing this?
[QUOTE=Z_guy;32475593]Of course, that is always what is happening.[/QUOTE]
How would I access it from the RAM, without any of it going to the HDD?
[QUOTE=leontodd;32475966]How would I access it from the RAM, without any of it going to the HDD?[/QUOTE]
1.) Create buffer
2.) Download file into buffer
3.) Access buffer
[QUOTE=leontodd;32475966]How would I access it from the RAM, without any of it going to the HDD?[/QUOTE]
Well, what are you using to download the file?
[QUOTE=SourBree;32475905]I've got a set of X, Y coordinates and I need to check which coordinates they are closest too in a list I have with lots of X, Y coordinates. I'm using Python, how exactly should I go about doing this?[/QUOTE]
Some sort of spatial partitioning scheme. Look at VP-trees, quadtrees or k-D trees. Each will provide O(log(n)) nearest neighbor lookups.
Sorry, you need to Log In to post a reply to this thread.