Technically getsales(int a[13] could be getsales(int a[11] since array indexing starts at 0 and he only needs 12 months 0-11. But note that in his while statement month starts at 0 and goes to month...
Type: Posts; User: jerryvtts
Technically getsales(int a[13] could be getsales(int a[11] since array indexing starts at 0 and he only needs 12 months 0-11. But note that in his while statement month starts at 0 and goes to month...
I changed your "getsales" function only as an example. I also printed out the "a" array after the "while" loop just to show that it worked. You can take out the three lines that do this.
Note...
Hammer is of course correct which tells me if you're going to answer questions in this forum you had better try it on more than
one platform or you will get "THE HAMMER"
%d in printf does indeed specify an integer so the "&" is not needed. I always say " the address of" when I type code that
contains the "&" with a variable. Seems to help me.
There are many...
There must be some other problem because I got this to compile and run with turbo C.
#include <stdio.h>
int main(void)
{
char *pointer = "hello";
How about posting your #include files and I'll see if I can get it to work.
What compiler are you using? It should have given you a warning about the following line like "Possibly incorrect assignment......".
You actually need two equal signs here ortherwise you are...
I have a really old version of Turbo C and I got this to work.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main(void)
{
Here's a real simple version of how to do this.
Hope it helps.
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main(void)
In my opinion hardware engineers can usually write some
software but software engineers can't design hardware.
The person who can do both proficiently is the most
valuable and makes the most...
I got your magic box program to work. Here's the working version
with a couple of comments to show you what I did. I did some reformatting of your source code because it's the only way I could...
Also, this isn't going anywhere:
>while(input[n++]!='\0')
>{
>switch(input[n])
Hammer. this was my fault. It should have been:
while(input[n]!='\0')
I ran your program and it worked fine.
Here's what the screen looked like after all entries:
Welcome to "Weather Wizard" Unit Convertor!
Please enter values in 'ENGLISH' units:
Enter Fahrenheit...
Note that sscanf isn't an ordinary method or built-in function, but a very special construction in Pike. The reason is that sscanf has to change its arguments, and since Pike uses call-by-value, no...
I can't quite figure out what your program is trying to do
but CTRL+C is a dangerous thing to ask the user to type.
When the console server detects a CTRL+C it terminates the
execution of the...
OH I get it!
Thanks
shift/fill warning.
The shift operators << and >> perform left and right shifts of their left
operand by the number of bit positions given by the left operand.
Thus x << 2 shifts the value of...
jerry, please can you use code tags for the code (see my sig for an example). It helps make the code readable by keeping the layout as it is in your editor. Thanks.
Hammer could you please...
As i've learned from this forum you should use "fgets" instead of "gets".
You have the right idea but it can be done with a lot less code(work).
Here's some streamlined code that will do what...
getchar() reads a character from the standard input, usually the
keyboard. getchar will also 'echo" the typed character to the standard output, usually the user screen.
I couldn't tell...
You're trying to take in an integer and check it in the "switch" against an ascii character. You should have been able to find this
problem with a debug session.
Try the following:
...
No 8's or 9's sounds like you want to work in octal(base 8). If this is the case take in any numbers from the user and use:
// Code
printf("%o", number);
to display it.
Well I guess I'm too isolated from the real world to know about the
long known problems with "gets".
I debugged this on my PC not on Unix.
I loaded a real old version of TC to get the...
I direct this thread spacifically to Sebastiani, Hammer or Prelude
who seem to know their C code.
I'm new to this forum and I note that several contributers don't like
the "gets" command. I...
If you're going to write C you have to do most of the work to make sure the user enters the expectes data. I agree with the
response that said you should take in the date 12/34/56 and then
parse...