Hello:
Right now say; I have a 12x6 grid full of numbers from 1-999.
If I want to find a sequence of numbers in this grid that exists in a straight line in the following 8 directions: North, North...
Type: Posts; User: drag0n69
Hello:
Right now say; I have a 12x6 grid full of numbers from 1-999.
If I want to find a sequence of numbers in this grid that exists in a straight line in the following 8 directions: North, North...
How would I do that? Could you maybe show me an example?
We are currently learning about pointers; does something like this require the use of pointers possibly?
I am basically taking the sequence...
Hi:
What would be the best way to read a sequence of numbers that are separated by white spaces?
EX: "10 20 30 -1"
The -1 will be used to mark the end of the sequence.
I will use the numbers in...
Thanks for all the help guys.. But I think I am finally going to give up on this problem...
I mean I solved the overflow problem and made sure the program worked for those range of numbers......
Aha.
Yes numbers for n and a that are getting to the highest do cause negative answers (which i assume means overflow)...
I included the extra header; it helped edge the overflow to a larger...
N and A (integer, 1<=N<=150 & integer, 0<=A<=15)
Does that help?
At first I left the code without the if statement at the very end (the one that gets rid of the last \ n) but I got wrong answer as well. Im pretty sure my calculations are all correct. But you don't...
yuh well now im just confused...
here is my final code that i submitted to the judge and got a "wrong answer" reply to...
/* CSC1140@ 07611201 74kzYkXl 10523 */
#include <stdio.h>
int...
Nevermind. I found my own error!
I had to add "int argc, char* argv[]" and "return 0;" to my code for it to compile with no warnings.
Thanks guys for all the help!!!
Aha. What a stupid mistake sorry about that.
Hey now I finally got the program working 100%.
#include <stdio.h>
int main()
{
int n,a;
int calc,sum,x,i,final_a;
#include <stdio.h>
int main()
{
int n,a;
int calc,sum,x,i,final_a;
while(scanf("%d %d",&n,&a) == 2)
{
sum=0;
Ahh I see. That works! Thanks so much.
Now my values are screwed up though. Like when I try to ech out x,i,final_a or any variable; they are all really high messed up values; maybe memory addresses?
I also tried to print out:
scanf("%d %d",&n,&a)
and I got *
If I use that; I get no output at all..
So how would I correct the problem?
Should I click the input first for n,a first? But then I couldn't loop the input and I wouldn't know where to stop...
Any help would be greatly appreciated!
tabstop:
how would I correct this type of program? should I use getchar() instead of scanf() for the n,a variables as well?
Thanks for the help!
So after reading all the replies I got something like this:
#include <stdio.h>
int main()
{
int c,n,a,calc,sum=0,x,i,final_a;
while((c = getchar()) != EOF)
Hello:
I am trying to make an application which takes input of sets of 2 numbers and does a mathematical equation with them and displays the answer for each set.
However; I have been testing and...
Thanks for the help guys.
However; so I am going to assume the input is from a text file... then what would the loop for the input look like? Would I use a "do-while" loop or another one? I am...
Hello:
I am attempting at this Online Judge problem:
http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=17&page=show_problem&problem=1464
The...
Hmm... now I am really confused. Because I am maybe thinking about this problem way harder then it is. I am thinking about using pointer, dynamic arrays, and such...
Basically I understand I can...
So how does the code tell the input has ended? is this based on scanf() inputs or file based inputs.
The exact words the problem says is: "For each line of the input, your correct program should...
Thanks for the clearification.
I have not learned about buffers yet. What topic would they be under? (So i can read about them in my textbook.)
In your sample code; you have a comment saying parse...
Thanks for your reply;
but what does that code exactly do? The thing is I do not know if it will be EXACTLY 2 lines of input or not. If I knew it would be exactly a number of inputs; then it would...
Thanks for the long explanation! I really appreciate your help.
I have a few questions concerning what you said about calling functions; taking the function return variable and recalling the...