oneuh
Type: Posts; User: Stormweaver1
oneuh
Alright updated my code I think I'm on the right track. I finally figured out what was pointing at what >.<
Nevermind...
Alright sweet that worked thanks.
Now I'll start working on the next function.
The awkwardness of having to keep a “previous” pointer while operating on a list using a
loop can be avoided by maintaining these pointers in the data structure itself.
struct node {
int first;...
It works now thank you very much :)
A regular number is a positive integer all of whose prime factors are in the set {2, 3, 5}. (1
is assumed to be regular.) Write a function regular that consumes a positive integer n and
prints out...
Yay it worked thank you very much :).
It was also alot simpler. But that's a good way to learn...to screw up big time lol
ooo i should just do 2 while loops.
where the first 1 counts up for the x value and the second one counts up for the y value.
and if they match then print it.
hmmm...when i reach the line
return sumsqr(n);
do all my integers get redefined back to 0?
Alright that seemed to work. Until I typed
./sumsqr
I got a Microsoft Windows error
"sumsqr.exe has stopped working" I'm going to assume this means I have an infinite loop.
Ok I changed what you asked and a few other things I noticed.
sumsqr-driver.c looks like
#include <stdio.h>
#include "sumsqr.h"
int main() {
Alright Question to is as follows.
"Write a function sumsqr that consumes a non-negative integer n and prints all pairs (x, y)
such that x and y are nonnegative integers, x >= y, and x^2 + y^2 =...
Alright Question to is as follows.
"Write a function sumsqr that consumes a non-negative integer n and prints all pairs (x, y)
such that x and y are nonnegative integers, x >= y, and x^2 + y^2 =...
:) So i changed isqrt.h to a "prototype"
int isqrt(int n);
and it appears to work! Thank you very much for your help. I have learned more from you then I have from a lecture.
Now onto...
alright I googled it and searched for it on these forums clicked a few links and I still don't understand what you mean by a prototype.
no i don't know what a prototype is :(. I just saved isqrt.c as isqrt.h
ok i'll google it.
so i deleted the isqrt.h but now its complaining that isqrt.h doesn't exist again.
I'm very confused. I'll keep trying different things though.
o...but i have 2 because i thought you needed one for isqrt.c and one for isqrt.h
but I guess I'll delete the isqrt.h one.
alright all of the errors went away now i have a new one. So I think I'm close.
/cygdrive/c/Users/user/AppData/Local/Temp/ccwWTWvi.o:isqrt.c:(.text+0x0):multip
le definition of '_isqrt'...
:O there's no little ";" semi-colon thing.
I'll give that a try, Thanks a bunch :)
so i included the math line
#include <math.h>
int isqrt(int n) {
int a = sqrt(n);
int b = 0
for (int i = 1; i <= a; i = i+1)
1) .....I don't understand. Do you mean I have to compile isqrt.c all on its own as opposed to compiling them at the same time? Or do I have to save isqrt.c as isqrt.h somewhere?
2) I think I did...
well we were given startup code for isqrt-driver.c
#include <stdio.h>
#include <assert.h>
#include "isqrt.h"
int main() {
So the question is
Write a function isqrt that consumes a non-negative integer n and produces the largest
integer less than or equal to the square root of n (that is, the integer square root of...