Forum: C 9 Days Ago |
| Replies: 7 Views: 269 >>But this looks ugly and I had to use a separate variable.
I think that looks beautiful. In fact you can just make a function that does that, and so it will be in a sense a one liner.
I don't... |
Forum: C 15 Days Ago |
| Replies: 3 Views: 356 You need to do a little more :
int LoadBitmap(const char* filename)
{
GLubyte* pixels;
HBITMAP hbmp;
BITMAP bmp;
GLuint size;
GLenum format; |
Forum: C 19 Days Ago |
| Replies: 1 Views: 322 don't use the sqrt function. compare the squared distance. |
Forum: C Oct 16th, 2009 |
| Replies: 5 Views: 299 Haven't tested it yet, but it could be similar to this :
int M = 5;
int i = 1;
while(i <= M) cout << i++ <<" "; //print from 1 to 5
while(--i > 0) cout << i << " "; //print from 4 to 1 |
Forum: C Sep 18th, 2009 |
| Replies: 11 Views: 422 Yes, structure goes by units of 4. |
Forum: C Sep 18th, 2009 |
| Replies: 8 Views: 592 int cnt = 0;
for infinite loop
{
//do stuff
if(//do stuff is what i need) // then break;
else cnt++;
//if cnt is above the limit then break;
} |
Forum: C Sep 17th, 2009 |
| Replies: 17 Views: 572 sizeof(array)/sizeof(double) ? |
Forum: C Sep 14th, 2009 |
| Replies: 8 Views: 677 Have a left, middle, and end variable. Make middle static.
Move left up 1, move end down 1. If left == mid || right == mid then stop. |
Forum: C Aug 28th, 2009 |
| Replies: 4 Views: 349 I think what you are looking for is something like this :
char *twoDee[][3] = {{"item1", "1", "1"}, {"item2", "1", "2"}};
You need to supply the column before hand.
Thus the code :
... |
Forum: C Aug 18th, 2009 |
| Replies: 22 Views: 1,131 Here is another way you might want to try. Its in c++ though.
You could try to convert it into c.
float GetFloat()
{
std::cout<<"Enter a number please : ";
float num(0);
cin >> num; |