473,769 Members | 3,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help needed please!

Hi guys!

Task 1: Write a program which presents a menu with 5 options. The 5th
option quits
the program. Each option should execute a system command using system().

Below is my humble offering.
=============== =============== =============== ======
#include <stdio.h>
#include <stdlib.h>

int menu( void );

int main( void )
{
int option;

while(1) {
option = menu();
switch(option) {
case 1:
system("dir");
break;
case 2:
system("help");
break;
case 3:
system("time");
break;
case 4:
system("type menu.c");
break;
case 5:
puts("Quitting program");
exit(0);
default:
puts("Not a valid option, try again");
}
}
return 0;
}

int menu( void )
{
int option;

puts("1. List directory");
puts("2. help");
puts("3. time");
puts("4. type menu.c");
puts("5. Quit");
scanf("%d", &option);

return option;
}
=============== =============== =============== =============
Problem: My compiler is giving me an "unreachabl e code" warning for line
32(return 0;). The
program runs fine. Why does the compiler(Borlan d C++ Builder 6) give this
warning?

Task 2: Create a calculator program.

Below is my humble offering.
=============== =============== =============== =============== =======
#include <stdio.h>

void add(int a, int b);
void subtract(int a, int b);
void multiply(int a, int b);
void divide(int a, int b);

int main( void )
{
int a, b;
char c;

puts("Enter an integer");
scanf("%d", &a);
puts("Enter an operator");
scanf("%c", &c);
puts("Enter another integer");
scanf("%d", &b);
switch( c ) {
case '*':
multiply(a, b);
break;
case '+':
add(a, b);
break;
case '-':
subtract(a, b);
break;
case '/':
divide(a, b);
break;
default:
puts("Operator is not valid");
}
return 0;
}

void add(int a, int b)
{
printf("Sum is: %d", a+b);
}

void subtract(int a, int b)
{
printf("Answer is: %d", a-b);
}

void multiply(int a, int b)
{
printf("Product is: %d", a*b);
}

void divide(int a, int b)
{
printf("Answer is: %d", a/b);
}
=============== =============== =============== ========
Output:

Enter an integer
2
Enter an operator
Enter another integer

Problem: Why does the program not allow the user to input the operator
before
jumping straight to "Enter another integer"? I think I am missing
something very
fundamental here.

Thanks in advance guys! Love your work!

Buck
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 14 '05
15 2756
On Sat, 17 Jan 2004 11:17:52 UTC, Buck Rogers <wh*@cares.com. au>
wrote:
Hi guys!

Task 1: Write a program which presents a menu with 5 options. The 5th
option quits
the program. Each option should execute a system command using system().

Below is my humble offering.
=============== =============== =============== ======
#include <stdio.h>
#include <stdlib.h>

int menu( void );

int main( void )
{
int option;

while(1) {
This while is NOT wrong! But some compilers like to give you a warning
here that the test is against a constant. Avioding this warning is
simple: replace the while with

for (;;) {

The result is the same - but the compiler is quite still.Somebody like
to have a macro for this:

#define FOREVER for (;;)

and then instead writing the empty loop like
FOREVER [
but it is easy to trick out onesef because one tends to append the
semicolon to the macro - and as that is not a syntax error it produces
some unwanted code.
option = menu();
switch(option) {
case 1:
system("dir");
break;
use continue istead of break; break breaks the switsh block. continue
iterates the while and shows the reader that your current run is
clearly done.
case 2:
system("help");
break; same case 3:
system("time");
break; same case 4:
system("type menu.c");
break; same case 5:
puts("Quitting program");
exit(0);
Even as this is well you can use break here now instead to exit
immediately.
default:
puts("Not a valid option, try again");
another continue here makes cleear that you will run the next while.
}
Now, whenever you falls through the switch block you knows your while
should break, so

break;

lets you reach the return and the compiler will be happy.
}
return 0;
}

int menu( void )
{
int option;

puts("1. List directory");
puts("2. help");
puts("3. time");
puts("4. type menu.c");
puts("5. Quit");
scanf("%d", &option);

return option;
}
=============== =============== =============== =============
Problem: My compiler is giving me an "unreachabl e code" warning for line
32(return 0;). The
program runs fine. Why does the compiler(Borlan d C++ Builder 6) give this
warning?

Task 2: Create a calculator program.

Below is my humble offering.
=============== =============== =============== =============== =======
#include <stdio.h>

void add(int a, int b);
void subtract(int a, int b);
void multiply(int a, int b);
void divide(int a, int b);

int main( void )
{
int a, b;
char c;

puts("Enter an integer");
Depending on your terminal nothing is shown yet. This is because
stdout is line bufferd and until one or both of the following cases is
not fullifyied nothing is send to the stream: either line is full or
newline is given.

fflush(stdout);

resolves that. This forces the stream to send the buffer to the device
immediately.

scanf("%d", &a);
scanf is errornous! You should avoid it. O.k., here is buffer overflow
no problem, but when you use scanf with other format string it is easy
to fall into that trap.

scanf is not designed to interact with keyboard or other other
untrusted devices. It ends up with giving you nothing when the input
does not match the format, living the unmatched data in stream.

puts("Enter an operator");
scanf("%c", &c);
puts("Enter another integer");
scanf("%d", &b);
Same as in the program above. Type something unwanded - and scanf
gives you nothing and anything hungs because scanf gives you nothing.
You can trap wrong input here: scanf returns the number of fields it
has filled, so
int rc = scanf("%d");
if (rc == 1) {
/* one value readed */
} else {
/* no value gotten, input wrong */
/* do something to receive the crap and continue */
/* attention: fflush() is undefined for input streams! */
}
switch( c ) {
case '*':
multiply(a, b);
break;
case '+':
add(a, b);
break;
case '-':
subtract(a, b);
break;
case '/':
divide(a, b);
break;
default:
puts("Operator is not valid");
}
return 0;
}

void add(int a, int b)
{
printf("Sum is: %d", a+b);
}

void subtract(int a, int b)
{
printf("Answer is: %d", a-b);
}

void multiply(int a, int b)
{
printf("Product is: %d", a*b);
}

void divide(int a, int b)
{
printf("Answer is: %d", a/b);
}
=============== =============== =============== ========
Output:

Enter an integer
2
Enter an operator
Enter another integer

Problem: Why does the program not allow the user to input the operator
before
jumping straight to "Enter another integer"? I think I am missing
something very
fundamental here.


scanf is a problem, any other higher functions like fscanf too. The
problem is that all the functions are designed in a time as punchcards
were the standard input and console (TTY) were operator input (an
operator is/was commonly more trained to interact with his computer.
That was in the old days where PCs was not invented. We have to live
with now.

So any experienced programmer has his own library of helkper functions
to avoid this flaws. As getc() gives more and direct control over the
stream one of them is:

/* clean input stream */
int MyFlush(FILE *in) {
int c;

while ((c = getc(in)) != EOF && c != '\n')
; /* do nothing */
return c;
}

/* helper function to read numerical values */
/* read from stream an unsigned number */
/* return number in *u and number of digits readed as result */
static int GetNumber(FILE *in, unsigned long *u) {
int c;
int rc = 0;
int i = 0;

while ((c = getc(in) != EOF) {
if (c == '\n') break; /* newline found */
if (isdigit(c)) {
rc *= 10;
rc += c - '0';
i++;
/* read more! */
continue;
}
break;
}
/* not a digit */
ungetc(in); /* unwanted char back to stream */
*u = rc;
return i;
}
/* get an unsigned int from stream
*/
/* the value must be greater or equal to min and less or equal to max
*/
/* FILE *in stream to read from */
/* unsigned min, max minumum maximum value */
/* char *msg message shown to user, when NULL, nothing */
/* char *errmsg[] error messages: */
/* [0] number given < min */
/* 1 > max
*/
/* 2 not a number
*/
/* return value readed
*/
/*

unsigned int GetUInt(FILE *in,
unsigned min, unsigned max,
char *msg, char *errmsg[]) {
unsigned long u = 0; /* final result */
int l;

for (;;) {
if (msg) {
fputs(msg, stdout);
fflush(stdout);
}
if (GetNumber(in, &u)) {
if (u < min) {
fputs(errmsg[0]);
continue;
}
if (u > max) {
fputs(errmsg[1]);
continue;
}
break;
}
fputs(errmsg[2]);
}
return (unsigned int) u;
}

how to read signed int, float.... left as homework to the reader.
When your compiler supports unsigned long long use that instead of
unsigned long as intermediate values.
--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation

Nov 14 '05 #11
"The Real OS/2 Guy" <os****@pc-rosenau.de> wrote in message
news:wmzsGguTDN 6N-pn2-6xUmS86KvrDj@mo on...
On Sat, 17 Jan 2004 11:17:52 UTC, Buck Rogers <wh*@cares.com. au>
wrote: ....
#include <stdio.h>
#include <stdlib.h>

int menu( void );

int main( void )
{
int option;

while(1) {


This while is NOT wrong! But some compilers like to give you a warning
here that the test is against a constant. Avioding this warning is
simple:


And unnecessary. [Just turn off the warning or get a better compiler... ;-]
replace the while with

for (;;) {

The result is the same - but the compiler is quite still.
Not if someone writes a compiler with warnings like...

warning: no expression used in for loop

Warnings (and the ability to turn them off) is a QoI issue.
Somebody like to have a macro for this:

#define FOREVER for (;;)

and then instead writing the empty loop like
FOREVER [
but it is easy to trick out onesef because one tends to append the
semicolon to the macro - and as that is not a syntax error it produces
some unwanted code.
It seems to lose something in translation, but it sounds like a good reason
for not defining such a macro. ;)
option = menu();
switch(option) {
case 1:
system("dir");
break;


use continue istead of break; break breaks the switsh block. continue
iterates the while and shows the reader that your current run is
clearly done.


I don't think that's a good thing to do in general. If the programmer later
wants to add some housekeeping after the the switch statement, then they've
got to replace all the continue statements [back to breaks which would have
worked just fine in the initial instance.]

....
default:
puts("Not a valid option, try again");


another continue here makes cleear that you will run the next while.
}


Now, whenever you falls through the switch block you knows your while
should break, so

break;

lets you reach the return and the compiler will be happy.
}
That looks like goto style spagetti code to me!
return 0;
}
.... int main( void )
{
int a, b;
char c;

puts("Enter an integer");


Depending on your terminal nothing is shown yet.


Yes, you will need a working switched on monitor to see the prompt! <g>
This is because
stdout is line bufferd and until one or both of the following cases is
not fullifyied nothing is send to the stream: either line is full or
newline is given.

fflush(stdout);

resolves that. This forces the stream to send the buffer to the device
immediately.

The puts() call appends a \n to the output [though fputs() doesn't.] If
stdout is fully buffered, then the user isn't likely to see the prompt with
or without the fflush. So the fflush() is redundant in this case.
scanf("%d", &a);


scanf is errornous! You should avoid it. O.k., here is buffer overflow
no problem, but when you use scanf with other format string it is easy
to fall into that trap.

scanf is not designed to interact with keyboard or other other
untrusted devices.


Huh?
It ends up with giving you nothing when the input
does not match the format, living the unmatched data in stream.
puts("Enter an operator");
scanf("%c", &c);
puts("Enter another integer");
scanf("%d", &b);
Same as in the program above. Type something unwanded - and scanf
gives you nothing and anything hungs because scanf gives you nothing.
You can trap wrong input here: scanf returns the number of fields it
has filled, so
int rc = scanf("%d");


You're missing a destination for the converted input.
if (rc == 1) {
/* one value readed */
} else {
/* no value gotten, input wrong */
/* do something to receive the crap and continue */
/* attention: fflush() is undefined for input streams! */
}
<snip>
Problem: Why does the program not allow the user to input the operator
before
jumping straight to "Enter another integer"? I think I am missing
something very
fundamental here.


scanf is a problem, any other higher functions like fscanf too. The
problem is that all the functions are designed in a time as punchcards
were the standard input and console (TTY) were operator input (an
operator is/was commonly more trained to interact with his computer.


What are you smoking, and where can I get some? <g>
That was in the old days where PCs was not invented. We have to live
with now.

So any experienced programmer has his own library of helkper functions
to avoid this flaws. As getc() gives more and direct control over the
stream one of them is:
<snip>
/* helper function to read numerical values */
/* read from stream an unsigned number */
/* return number in *u and number of digits readed as result */
static int GetNumber(FILE *in, unsigned long *u) {
int c;
int rc = 0;
Why not just use *u ?
int i = 0;

while ((c = getc(in) != EOF) {
if (c == '\n') break; /* newline found */
Redundant test as '\n' is not a digit.
if (isdigit(c)) {
if (isdigit((unsig ned char) c))
rc *= 10;
rc += c - '0';

And what happens if and when the int overflows?
i++;
/* read more! */
continue;
}
break;
}

More spagetti code! Try...

while ( (c = getc(in)) != EOF
&& isdigit((unsign ed char) c) )
{
/* process next digit */
}
/* not a digit */
ungetc(in); /* unwanted char back to stream */
*u = rc;
return i;
}


Your method does nothing to detect the case where an unsigned integer
overflow has occured. That said, 100% bullet proof methods for integer input
are surprisingly non trivial.

--
Peter
Nov 14 '05 #12
On Sun, 18 Jan 2004 00:33:37 GMT, nrk
<ra*********@de vnull.verizon.n et> wrote:
Barry Schwarz wrote:
On Sat, 17 Jan 2004 12:19:41 GMT, nrk
<ra*********@de vnull.verizon.n et> wrote:
Buck Rogers wrote:

Hi guys!

Task 1: Write a program which presents a menu with 5 options. The 5th
option quits
the program. Each option should execute a system command using system().

Below is my humble offering.
=============== =============== =============== ======
#include <stdio.h>
#include <stdlib.h>

int menu( void );

int main( void )
{
int option;

while(1) {
option = menu();
switch(option) {
case 1:
system("dir");
break;
case 2:
system("help");
break;
case 3:
system("time");
break;
case 4:
system("type menu.c");
break;
case 5:
puts("Quitting program");
exit(0);
default:
puts("Not a valid option, try again");
}
}
return 0;
}
snip
Problem: My compiler is giving me an "unreachabl e code" warning for line
32(return 0;). The
program runs fine. Why does the compiler(Borlan d C++ Builder 6) give
this warning?
The only way out of your while ( 1 ) loop is through the exit(0) call, and
that doesn't bring you to the return 0; statement either. Hence the
complaint. Ideally, you should be able to replace the exit(0) call with


Why? The exit(0) works fine.


Except for the complaint from OP's compiler. Simply getting rid of the
return statment may not be an option as the compiler may complain about no
value being returned from main. Of course, you could just happily co-exist
with the compiler diagnostic as well.


Replacing the exit(0) with return 0 will do nothing to silence the
complaint.

-nrk.
return 0; get rid of the existing return statements and the compiler
should be happy.


<<Remove the del for email>>


<<Remove the del for email>>
Nov 14 '05 #13
nrk
Barry Schwarz wrote:
On Sun, 18 Jan 2004 00:33:37 GMT, nrk
<ra*********@de vnull.verizon.n et> wrote:
Barry Schwarz wrote:
On Sat, 17 Jan 2004 12:19:41 GMT, nrk
<ra*********@de vnull.verizon.n et> wrote:

Buck Rogers wrote:

> Hi guys!
>
> Task 1: Write a program which presents a menu with 5 options. The 5th
> option quits
> the program. Each option should execute a system command using
> system().
>
> Below is my humble offering.
> =============== =============== =============== ======
> #include <stdio.h>
> #include <stdlib.h>
>
> int menu( void );
>
> int main( void )
> {
> int option;
>
> while(1) {
> option = menu();
> switch(option) {
> case 1:
> system("dir");
> break;
> case 2:
> system("help");
> break;
> case 3:
> system("time");
> break;
> case 4:
> system("type menu.c");
> break;
> case 5:
> puts("Quitting program");
> exit(0);
> default:
> puts("Not a valid option, try again");
> }
> }
> return 0;
> }
>
snip
> Problem: My compiler is giving me an "unreachabl e code" warning for
> line 32(return 0;). The
> program runs fine. Why does the compiler(Borlan d C++ Builder 6) give
> this warning?
>

The only way out of your while ( 1 ) loop is through the exit(0) call,
and
that doesn't bring you to the return 0; statement either. Hence the
complaint . Ideally, you should be able to replace the exit(0) call with

Why? The exit(0) works fine.


Except for the complaint from OP's compiler. Simply getting rid of the
return statment may not be an option as the compiler may complain about no
value being returned from main. Of course, you could just happily
co-exist with the compiler diagnostic as well.


Replacing the exit(0) with return 0 will do nothing to silence the
complaint.


It will. Read the rest of the quote that follows below.

-nrk.

-nrk.
return 0; get rid of the existing return statements and the compiler
should be happy.

--
Remove devnull for email
Nov 14 '05 #14
On Sun, 18 Jan 2004 14:16:41 UTC, "Peter Nilsson" <ai***@acay.com .au>
wrote:
"The Real OS/2 Guy" <os****@pc-rosenau.de> wrote in message
news:wmzsGguTDN 6N-pn2-6xUmS86KvrDj@mo on...
On Sat, 17 Jan 2004 11:17:52 UTC, Buck Rogers <wh*@cares.com. au>
wrote: ...
#include <stdio.h>
#include <stdlib.h>

int menu( void );

int main( void )
{
int option;

while(1) {


This while is NOT wrong! But some compilers like to give you a warning
here that the test is against a constant. Avioding this warning is
simple:


And unnecessary. [Just turn off the warning or get a better compiler... ;-]


Never! Each warning a compiler can give you is important when you not
aware of. A condition that evaluates always true is often senseless
and points to a programming error.
A loop without condition is in contrast to that normal.

replace the while with

for (;;) {

The result is the same - but the compiler is quite still.


Not if someone writes a compiler with warnings like...

warning: no expression used in for loop


This is senseless - always.
Warnings (and the ability to turn them off) is a QoI issue.
Somebody like to have a macro for this:

#define FOREVER for (;;)

and then instead writing the empty loop like
FOREVER [
but it is easy to trick out onesef because one tends to append the
semicolon to the macro - and as that is not a syntax error it produces
some unwanted code.
It seems to lose something in translation, but it sounds like a good reason
for not defining such a macro. ;)
option = menu();
switch(option) {
case 1:
system("dir");
break;


use continue istead of break; break breaks the switsh block. continue
iterates the while and shows the reader that your current run is
clearly done.


I don't think that's a good thing to do in general. If the programmer later
wants to add some housekeeping after the the switch statement, then they've
got to replace all the continue statements [back to breaks which would have
worked just fine in the initial instance.]


No, but you may use flages to handle flags to handle flags when you
are unable to work out a clean design. Don't hack around and you'll
have always functions with a clean design, avoiding gotos, flags and
flags you don't need. Learn how to use continue and you'll save flags
have clean and short code.

Whenever an action is done 'contimue' is good to flag that. 'break'
shows that you're halfway done, but something left over for common
actions.

'exit()' is good for emergency breakout - but never for break on data
fault. A well designed program does never use exit except for an point
whereas nothing else makes sense.
...
default:
puts("Not a valid option, try again");
another continue here makes cleear that you will run the next while.
}


Now, whenever you falls through the switch block you knows your while
should break, so

break;

lets you reach the return and the compiler will be happy.
}
That looks like goto style spagetti code to me!


No, it's clear: continue shows up that anything to do is done, next
loop has to run. Break from switch shows that there is something left
to do. And in this case the only that can left over is to break the
whole loop. spaghetti code looks absolutely different. It were easy to
use goto but goto will break ever the flow - and there is no need to
break the flow. Again, learn what continue does for you. It helps you
to document the data flow!
return 0;
}
... int main( void )
{
int a, b;
char c;

puts("Enter an integer");


Depending on your terminal nothing is shown yet.


Yes, you will need a working switched on monitor to see the prompt! <g>


[ ] You knows the difference between unbuffered, line buffered and
block buffered devices.
This is because
stdout is line bufferd and until one or both of the following cases is
not fullifyied nothing is send to the stream: either line is full or
newline is given.

fflush(stdout);

resolves that. This forces the stream to send the buffer to the device
immediately.

The puts() call appends a \n to the output [though fputs() doesn't.] If
stdout is fully buffered, then the user isn't likely to see the prompt with
or without the fflush. So the fflush() is redundant in this case.
scanf("%d", &a);


scanf is errornous! You should avoid it. O.k., here is buffer overflow
no problem, but when you use scanf with other format string it is easy
to fall into that trap.

scanf is not designed to interact with keyboard or other other
untrusted devices.


Huh?


Give
d o n ' t t y p e t ex t wh en y h a ve t
o
t
y p
e
a n
um
er
instead a number and try to catch that. Users are crazy alays. You
have more work to catch typing errors than to work with regular input.

Writing an own function to receive exactly that you awaits from the
stream makes it much easier to handle the crap a user gives you as you
ever can have with the old design (f)scanf() brings. Reading something
in only to copy it again to copy it again to scan it is waste of
resources.

Why not just use *u ?
A leftover from the old days where compilers were not so good in
optimising and code generation as today and the time difference
between indirect addressing as in modifying a variable a pointer
points to was really slow because the mashine was unable to do it
other than to read to a register modify that register and write back.
Direct register manipulation was in factor 10 to 100 more quick!

int i = 0;

while ((c = getc(in) != EOF) {
if (c == '\n') break; /* newline found */


Redundant test as '\n' is not a digit.


O.k., yes - but a bit documentation that distinguishes betwen unwanted
and wanted chars.
if (isdigit(c)) {


if (isdigit((unsig ned char) c))
rc *= 10;
rc += c - '0';

And what happens if and when the int overflows?


Have you ever done this test in a real program? You can do it anyway
as you can test if the number of digits should reflect it.
Your method does nothing to detect the case where an unsigned integer
overflow has occured. That said, 100% bullet proof methods for integer input
are surprisingly non trivial.


It is trivial - but costs more code when you have the real need to
dedect it immediately.

Save the old vale. Add and compare with the old value. Whenever the
old value is lower as the new one you have had an overflow in unsigned
arithmetic. Simple.

Does you really check each and any arithmetic operation for overflow?
I don't think so.

Here it is easy to let the user of the function do it when he feels
the need. That is one of the points why the function returns the
number of digits readed and not only the converted number.

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation

Nov 14 '05 #15
On Mon, 19 Jan 2004 05:29:19 GMT, nrk
<ra*********@de vnull.verizon.n et> wrote:
Barry Schwarz wrote:
On Sun, 18 Jan 2004 00:33:37 GMT, nrk
<ra*********@de vnull.verizon.n et> wrote:
Barry Schwarz wrote:

On Sat, 17 Jan 2004 12:19:41 GMT, nrk
<ra*********@de vnull.verizon.n et> wrote:

>Buck Rogers wrote:
>
>> Hi guys!
>>
>> Task 1: Write a program which presents a menu with 5 options. The 5th
>> option quits
>> the program. Each option should execute a system command using
>> system().
>>
>> Below is my humble offering.
>> =============== =============== =============== ======
>> #include <stdio.h>
>> #include <stdlib.h>
>>
>> int menu( void );
>>
>> int main( void )
>> {
>> int option;
>>
>> while(1) {
>> option = menu();
>> switch(option) {
>> case 1:
>> system("dir");
>> break;
>> case 2:
>> system("help");
>> break;
>> case 3:
>> system("time");
>> break;
>> case 4:
>> system("type menu.c");
>> break;
>> case 5:
>> puts("Quitting program");
>> exit(0);
>> default:
>> puts("Not a valid option, try again");
>> }
>> }
>> return 0;
>> }
>>
snip
>> Problem: My compiler is giving me an "unreachabl e code" warning for
>> line 32(return 0;). The
>> program runs fine. Why does the compiler(Borlan d C++ Builder 6) give
>> this warning?
>>
>
>The only way out of your while ( 1 ) loop is through the exit(0) call,
>and
>that doesn't bring you to the return 0; statement either. Hence the
>complain t. Ideally, you should be able to replace the exit(0) call with

Why? The exit(0) works fine.
Except for the complaint from OP's compiler. Simply getting rid of the
return statment may not be an option as the compiler may complain about no
value being returned from main. Of course, you could just happily
co-exist with the compiler diagnostic as well.
Replacing the exit(0) with return 0 will do nothing to silence the
complaint.


It will. Read the rest of the quote that follows below.


The rest of the quote will get rid of the complaint without replacing
the exit(0) with a return 0. I have no argument with your clause that
follows the semicolon. My question is what benefit is derived from
the clause before the semicolon?

-nrk.

-nrk.

>return 0; get rid of the existing return statements and the compiler
>should be happy.
>


<<Remove the del for email>>
Nov 14 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1584
by: Durham Writer | last post by:
Hi all, I'm currently working on a resource directory for the homeless, needy and those dealing with mental illness. The site is located at: http://triangle-resources.no-ip.org Triangle Resources denotes that this is for the Triangle area of North Carolina (Raleigh, Durham, Chapel Hill). Right now, I just list the information with html markup. I'm thinking there is a better way to present this and make it more useful, especially as...
5
1436
by: Raj.SB | last post by:
I have a reg exp pattern as below works fine for the string : <param name="url" value="contents/cf_intro.htm" valuetype="ref"> mObjRegExp.pattern="<param.+?value=""(+)"" But the same is not working for <param name="url" valuetype="ref" value="../fmmain/fmindex.htm" note that, i want to capture the url that comes after value=". if the value=" comes in the second place in the html tag it works. but if it comes in the 3rd position,...
2
293
by: Stephen | last post by:
I am trying to compare the tables in two similar environments using the SQLDMO object. I am able to use this object to access different SQL servers and choose two different databases. The versions of the databases are slightly different so I would like to be able to compare them for things like datatypes, primary and foreign keys, number of records etc. I know that there are packages out there that do this kind of thing but I have to...
0
1245
by: Stephen | last post by:
I was wondering if someone could please help me with an array I'd like to create in an asp.net page. I have to design an array which stores the values of addresses manually entered into textboxes (txtAdd,txtCity&txtPostcode). The array must hold the values of these three textboxes. I would like the array to also display these address values in an asp:Lable within a asp:TableCell inside a asp:Table. I want all this to happen on the...
2
1723
by: | last post by:
internal struct ConstantValue { internal DateTime EffectiveFrom; internal DateTime EffectiveThrough; internal DateTime DateValue; internal double DoubleValue; } internal struct Constant {
9
1670
by: silverchrono | last post by:
this is my first semester in C and im trying to figure out how to reset a counter. heres why im trying to do. void text() 59 printf("You can end entering the text by using '#'\n"); 60 int i=0; 61 int j=0;
4
1365
by: inspiretechnologies | last post by:
Hi all, I'm creating a Php page with connection to a MySql database. In this page, I get all the articles (text) of a member, and when the article's length exceeds 500 characters, a link "read more" is shown. I must implement with Ajax a function that allows, when the link "read more" is clicked, to show the rest of the article. It's a sort of slide down function but more complicated I think. I'm a beginner so please can someone help me...
3
1215
by: meddow | last post by:
Ive been asked to make a function to Convert Fahrenheit to Celsuis, via the on screen interface of the web page, nothing seems to be working for me, and i can not see whats wrong, please help <<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Temp</title> <meta...
4
1671
by: Dave G | last post by:
I've just been informed that an Access 2003 based system in use at one of my customers now needs to send data in the form of an XML file to a webservice. They told me it was simple - but I don't know anything about it and a googling session yesterday made it look very complicated. So can anyone help with this question - I don't need anything fancy and I haven't got the experience to work it all out for myself from first principles (even...
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.