and if i enter 7hello for example. it prints out seven.
Type: Posts; User: sworc66
and if i enter 7hello for example. it prints out seven.
This catches the invalid input but wont print out the number now when it is valid input.
int res;
int num;
int pos;
/* res = sscanf( cmd, "%d", &num); */
res =...
It wouldnt catch out all the invalid input by saying if theres any more chars after [3] its invalid input. How do i get it to catch it out if say the user entered: 56hj for example?
But theres a possibility that theres trailing chars, coz the numbers go up to 1000. I basically need to say that if a number inst entered its invalid input dont i? how do i go about doing that?
I need my program to output a message "invalid input" when the input is not correct by the user.
Currently my programs use is to allow the user to enter a number and the program outputs that...
In regards to the default case, i need the prog to only end if there is no input. If i put return 0; the prog ends only after one loop, and if i put break; the prog never ends.
Can anyone tell me...
Why doesnt the UNIX Kernel shrink the stack?
Im getting an error that says
>Undefined first referenced
> symbol in file
>
>stricmp num.o
when i test...
I get the message: makefile:6: *** missing separator. Stop.
Whats wrong with my makefile?
I dont have a book yet, i have one on order and im waiting for it to arrive.
In regards to the user inputting words, how do i go about that, should i use strstr or what?
int two(){
char word;
scanf("%s", &word );
switch(word){
...
Im getting an error and i dont know what i need to do to fix it. Also can anyone let me know if im doing the right thing here. I want my program to read from input either numbers or words and convert...
I have had a look at what the FAQ has to say about strcmp() but i still dont really know how i use it, or even if its what i need to use. I need to be able to look at whole words and not just...
how come my or doesnt work?
#include <stdio.h>
int len;
int i;
int main()
Ok i see how i use the gets, but how do i specify what i want it NOT to print out. Is it like what i did in the code in my last post or how so i do it. If you could point me to a tute that explains...
this isnt working but am i on the right track with this?
#include <stdio.h>
int main()
{
am i able to use scanf to read characters from input and then only print certain things back to output? How do i specify what i want it to print back out. For example if i only want it to print...
ok can you explain what a prototype is in simple terms for me plz.
i get this error:
bash-2.02$ gcc -o ass ass.c
ass.c:47: warning: type mismatch with previous implicit declaration
ass.c:43: warning: previous implicit declaration of `one'
ass.c:47: warning:...
I can only seem to find c++ tutes on this site... anyways... here is the start of what ive done. Can you show me using my code how to refer to functions outside of main() because i want to add more....
THanks everyone, its been great help. In regards to main() i just need a simple explination as to how i write functions outside of the main and then refer to them in the main. At the moment i really...
This works ok. How do i make it so that you can input different arguments instead of having them set when i run the program.. like i want to be able to enter values when i execute it if you know what...
what im trying to do is get the program to print the numbers in ascending order. How do i get the program to go to the swap part from main? Im not really understanding how to do things separatly from...
When im doing an if and then an else, and i want the else to be a "do nothing". How do i do that and can i have an example?
thanks :)
yep it works. thanks heaps guys.