Forum: C Feb 17th, 2009 |
| Replies: 2 Views: 436 Post a screenshot of the control. |
Forum: C Jan 22nd, 2008 |
| Replies: 6 Views: 1,003 Those statements are used to print a newline after 10 numbers are printed in a row.
% is the modulus operator. a%10 is 0 for numbers like 10, 20, and so on. So after the 10th number, the rest of... |
Forum: C Jan 22nd, 2008 |
| Replies: 6 Views: 1,003 What part to you not understand? |
Forum: C Jan 21st, 2008 |
| Replies: 12 Views: 47,418 In case you didn't notice, the fellow wanted the code in C. |
Forum: C Jan 15th, 2008 |
| Replies: 2 Views: 3,709 C FAQ (http://c-faq.com/decl/strlitinit.html). |
Forum: C Jan 5th, 2008 |
| Replies: 10 Views: 2,005 Here is the minimal code for a dialog box with a single push button. When experimenting it is always best to experiment with the least possible code.
#include <windows.h>
#define ID_1 4001
... |
Forum: C Jan 5th, 2008 |
| Replies: 10 Views: 2,005 From what I see, you are trying to create the pushbutton inside a menu. Is that what you are trying to do? If so, I don't think you can do that.
In any case, there is nothing wrong with the... |
Forum: C Mar 25th, 2007 |
| Replies: 2 Views: 6,004 argv[ 0] is the program name. You can see the contents by using this line
printf( "%s", argv[ 0 ] );
To get the first argument, and convert it to an integer, try this code.
#include... |
Forum: C Mar 15th, 2007 |
| Replies: 8 Views: 3,839 What is wingoze? Whatever it is, it may be an Operating system, and there should be a socket API for it. Look that up. |
Forum: C Nov 18th, 2006 |
| Replies: 5 Views: 1,195 Use the continue keyword. It skips to the next iteration.
for (i = 0; i < count; i++ )
{
if ( i == 5 )
continue;
stuff
} |
Forum: C Nov 14th, 2006 |
| Replies: 4 Views: 2,465 Good. Mind posting the solution so that someone else can learn from it?
Thank you. |
Forum: C Nov 13th, 2006 |
| Replies: 5 Views: 6,756 Why don't you read the documentation for Sleep() ???? |
Forum: C Nov 12th, 2006 |
| Replies: 4 Views: 2,465 Why are you using the strcpy function? These are C++ strings. Use the = operator.
thisRecord.fieldName =next |
Forum: C Nov 3rd, 2006 |
| Replies: 13 Views: 4,807 it should be like this.
void get_boat (int count, char type[10][128], int time[10])
{
} |
Forum: C Nov 2nd, 2006 |
| Replies: 13 Views: 4,807 Your snippet won't compile.
int array[][] = { {1, 12, 9}, {23, 12, 6} }; // cant declare 2-D arrays like this.
void something(int *something) { // cant pass 2-D arrays like this.
// ...
} |
Forum: C Nov 2nd, 2006 |
| Replies: 13 Views: 4,807 Just go through the link I posted. It has examples for single and 2 dimensional array passing. |
Forum: C Nov 1st, 2006 |
| Replies: 13 Views: 4,807 This (http://irc.essex.ac.uk/www.iota-six.co.uk/c/f3_passing_arrays_to_functions.asp)should serve as a good example. As the arrays are passed by reference, the modifications you make inside the... |
Forum: C Oct 26th, 2006 |
| Replies: 6 Views: 1,592 Just assign it zero here. You will also have to assign 1 to intPowr also.
if (intNumb == 0)
{
cout << "Sum of digits is :" << intSum << endl; // displays result when... |
Forum: C Oct 26th, 2006 |
| Replies: 8 Views: 2,332 Not sure about the theory. But here is a working code.
#include <stdio.h>
//#include <iomanip> why are you including this? You are not using it.
int main()
{
int binary1[8] =... |
Forum: C Oct 26th, 2006 |
| Replies: 4 Views: 1,183 The problem was the member allignment of the structure. For example, lets take your structure.
It has 15 chars and one int (that is 4 chars). So the size by adding them up is 19 chars. But try... |
Forum: C Oct 26th, 2006 |
| Replies: 4 Views: 1,183 Attachment? What attachment? |
Forum: C Oct 24th, 2006 |
| Replies: 6 Views: 1,592 (1567 / 1 ) % 10 = 7
(1567 / 10 ) % 10 = 6
(1567 / 100 ) % 10 = 5
(1567 / 1000) % 10 = 1
See a pattern? |
Forum: C Sep 28th, 2006 |
| Replies: 10 Views: 2,283 How about buying a C/C++ book, or taking a C/C++ class or reading a C/C++ tutorial (http://www.cprogramming.com/tutorial.html)? |
Forum: C Aug 22nd, 2006 |
| Replies: 9 Views: 1,325 Yes I think you are over-reacting a bit. Nobody thinks that you are an idiot, and if there is anyone who thinks that, it is (s)he who is the idiot.
Walt's advice is spot on. Summarizing, the basic... |
Forum: C Jul 9th, 2006 |
| Replies: 5 Views: 1,618 On the contrary, I find them pretty useful. Both as a communicating tool, since pseudocode can differ according to the person, and as a tool to understand the algorithm better. For example I couldn't... |
Forum: C May 23rd, 2006 |
| Replies: 2 Views: 885 I would use something like
if (sock!=INVALID_SOCKET)
{
if(send(sock,s,(int)strlen(s),0)==SOCKET_ERROR)
{
printf("Sendfailed.%d", WSAGetLastError());
}
}
and see. |
Forum: C Apr 3rd, 2006 |
| Replies: 25 Views: 9,548 The problem was not with the binary to decimal conversion. It was with the usage of char( x ). Anyway if the usage is not correct, it is fine with me. The correct output for 100001 was pure... |
Forum: C Apr 3rd, 2006 |
| Replies: 25 Views: 9,548 What you say about binary handling in computers is correct Dragon.
But what Server_Crash did, was not int n = "100001";
he didint n = 1000001; // this is correct.
What I don't get is how did char(... |
Forum: C Feb 3rd, 2006 |
| Replies: 5 Views: 3,289 What happens when you change your code to this?
char buf[512] = "";
CSocket tsock;
if ( hsock.Accept(tsock) == 0 )
{
// Error
return;
} |
Forum: C Dec 7th, 2005 |
| Replies: 9 Views: 2,386 Yeah I just ran it. So does mine.
yeah thought as much. Anyway got the desired output ( but i know it is bad code). Tried calling delete on it, but that does not also work. Why is that? |
Forum: C Dec 6th, 2005 |
| Replies: 9 Views: 2,386 vector <char*> constArray(10);
char* changingString = "hello";
constArray[0] = new char;
constArray[0] = changingString;
changingString = "yadayada";
printf("constArray[0] =... |
Forum: C Dec 5th, 2005 |
| Replies: 3 Views: 1,708 use the memset (http://www.cplusplus.com/ref/cstring/memset.html) function. |
Forum: C Nov 18th, 2005 |
| Replies: 3 Views: 1,292 1. Add a Control Variable of type CStatic to the Static Control( lets say m_Caption )
2. Add a CFont Private Variable to the Main Dialog ( say m_Font )
3. At the OnInitDialog Function do this
... |
Forum: C Nov 16th, 2005 |
| Replies: 33 Views: 7,057 Looks like you have defined i more than once in the same scope( i.e. inside the same {} brackets. ). Check at the line numbers given. Usually compiler errors are easy to handle by the programmer as a... |
Forum: C Nov 16th, 2005 |
| Replies: 33 Views: 7,057 you are using the C language. in C you cant declare the iterator i or j inside the for loop.
do this
int i, j;
for ( i = max( 0, x - 1 ) ; i < min( COLUMN - 1, x + 1 ); i++ )
{
for ( j =... |
Forum: C Nov 16th, 2005 |
| Replies: 33 Views: 7,057 Look at my occ function. The max and min functions take care of that.
int occ( int Grid[ ROW ][ COLUMN ], int x, int y )
{
int neighbourCount = 0 ;
for ( int i = max( 0, x - 1 ) ; i < min(... |
Forum: C Nov 15th, 2005 |
| Replies: 33 Views: 7,057 Quoted from Wikipedia.
Inside the generate( ) function, use occ to calculate the number of neighbours for all the cells in the grid, and according to the rules determine if the cell is dead or... |
Forum: C Nov 15th, 2005 |
| Replies: 33 Views: 7,057 Or something similar to this.
int occ( int Grid[ ROW ][ COLUMN ], int x, int y )
{
int neighbourCount = 0 ;
for ( int i = max( 0, x - 1 ) ; i < min( COLUMN, x + 1 ); i++ )
{
for ( int j =... |