My MSN Messenger alias is: [email protected]
Contact me anytime tonghgt for any help, comments, questions, you may have.
Type: Posts; User: Nit
My MSN Messenger alias is: [email protected]
Contact me anytime tonghgt for any help, comments, questions, you may have.
Here's a start.
struct car {
char color;
int ignition;
int xCoordinate;
int i;
int array[size];
void swap(your parameters) {
i = array[swapindex];
array[swapindex] = newvalue;
array[indextoswap] = i;
}
Could you do two things for us before we begin.
1. Use code tags ([.code] and closing [./code]) without the periods.
2. State your problem exactly.
I did an application like that in an early CS class. I had a lot of fun learning about the unix system and the different structures I had to work with.
Almost every problem in the programs that are posted is caused by programmers using scanf, while having a \n still in the buffer.
A simple solution to this would be to simply use fgets.
...
Use fgets.
#define MAX_INPUT = 100 //whatever you like
char buffer[MAX_INPUT + 1];
fgets(buffer, MAX_INPUT, stdin);
just type:
#include "myFile.c"
where your other includes are.
Check out these include files.
#include <sys/socket.h>
#include <netinet/in.h>
You may want to really look at this structure.
struct sockaddr_in servaddr;
don't use dot notation to access that structure's data fields. Use the -> operator.
struct customer *john;
john -> balance = 2.54;
And try,..
CUSTOMER bankrecords = (struct customer *)...
#include <stdio.h>
#define MAXROW 50
#define MAXCOL 100
main ()
{
int Row_Num, Col_Num;
char Map[MAXROW][MAXCOL];
char Moves[50];
I'm still lost. Ugh.
Let's say your header file has this inside of it.
myHeader.h
#define maxline 1024
#define minline 10
myProg1.c
#include "myHeader.h"
#include "Loader.h"
This statement is correct and any code that you wrote within that header file will be entered into your code during the preprocessor stage.
But, if that's not what you mean,...
strcmp(s1, s2)
returns 0 if they are equal. returns 1 if s1 is greater than s2 and returns -1 if s1 is less than s2.
Coded by fred_scotland
[B]#include <stdio.h>
while(( n < 0) || (n > 30 ))
{
printf("Wrong! number must be in the range 0 - 30\n");
scanf("%i", &n);
fflush(stdin);
}
I'm sure you could STFW or search the C++ Programming Board that is also included within this site. If that's a homework problem (which I assume it is) make sure you read the sticky post about that...
#include <stdio.h>
#define MAXLINE 1024
int add(int, int);
int subtract(int, int);
int multiply(int, int);
int divide(int, int);
float result = 0.0;
The spaces take care of the newline buffer problem. Try fgets instead....
due to fgets solution below
I can just imagine him/her searching the web for STFW...
A pointer is just a variable that holds a memory address.
[Edit]I'm not a very good teacher, so my analogy might just be that terrible...
int *y;
y is now a pointer to an integer. The value...
Try this link, C++ Programming Board . It's a link to the C++ development board on this site. They should be able to give you some help (with the right question).
My eyes are bloodshot also from reading that code with no '[code]' tags.
Is C still a contender?
*watches dead programmers turn in thier graves*
int high, num, low = 0;
while (test condition)
if (num > high)
high = num;
if (num < low)
low = num;
//grab next value of num from file, stdin, etc...