if you think decoding an IP header in your intro to networking class is hard, you're in for a rough time.
you need to become intimate with RFC 791. pay special attention to section 3, "specification"
oh, yeah, that ... i rarely deal with object files on windows.
anyhow, it sucks when two completely different files for two totally unrelated purposes use the same extension :P
Of course they're real issues to be aware of, should cokaznsyco72 continue on to program floating-point in real applications.
but of course
cokaznsyco, dr.b is correct that you need to be aware that programming floating point operations have an inherent issue with rounding errors. just like 1/3 has rounding problems in decimal arithmetic, 1/10 has rounding problems in binary arithmetic.
but when you do real applications with real floating point problems, you will also be using real functions from real standard libraries, and not these "getchar/putchar" stupid programming tricks your instructor is having you to do.
so, i'm just sayin', don't get too worried about it yet. :)
.
C is fine. and this is not very difficult
you will have to open the file as a binary file.
you need to understand the basics of the MP3 format to know where in the file you will find the "metadata" information such as artist, title, tracks, etc.
This metadata is typically formatted according to the ID3 specification, and appended to the end of the MP3 file. the start of the metadata tag is indicated by the 3-character string "TAG".
first thing you should do is open a small mp3 up in a text editor that you can view hex data and see what you see and compare the data with the MP3 and ID3 file format specifications.
.
why should they all be double? it seems to work fine with float
because type "float" has really poor precision, and is not sufficient for performing any significant floating point calculations as the rounding errors will stack and quickly become unacceptable. type "double" has much greater precision and the rounding errors will be much less noticeable. "double" is generally considered the default floating point type that you should always use, at a minimum. there is really no good reason to use "float". memory size is inconsequential.
and yes, Dr.B is correct about the entire method being susceptible to rounding errors. because the successive divides by 10 have inherent rounding error ... it's nice to be aware of it, but it will not affect your assignment. like most "doctors", Dr.B has led us into a pedantic discussion, that is tangential to your assingment. :)
don't worry about these details as far as turning in your homework. this is all beyond the scope of your assignment.
.
this doesn't make any sense, but if you must do something like this, then you need to get into the deep details of the windows API. since you're even asking this question, then you have no chance of successfully navigating the Windows API
therefore you will have to do something sloppy like::
use a system call to open your application
delay 2 minutes
use a system call to kill the process, with something like this
.
and chiwawa10, i'm flattered that you feel the urge to copy me, but please go ahead and find yourself another icon/avatar to use, and not steal mine.[/B].
that's not a stock avatar; it's not a coincidence that you picked the same avatar from some pool of images. that's one that i searched out on my own and personally trimmed to fit the specific pixel ratio for this site.
the problem here is that an array index is increasing beyond the boundaries of your array size, and trying to access memory that has not been allocated.
fix this
for (index=1; index < len; index++) {
.
yeah, and i should have specified that the values be all declared as type "double" lloating point. it's kind of assumed, but many people dont know or forget.
hay!!!
write it your damn self!
thanks
:)
awesome. i'm surprised you were able to interpret my description so quickly.
declare your variables at the top of main()... before your while loop.
declare your array 'home' size properly.
Mine aren't. Mine are all binary.
i dont think you're talking about the same thing as the poster is. .OBJ files are standard 3D graphics definition files for geometric objects . they're written in plain text. here is an example.
perhaps you're confusing them with .O "object files" built by a C compiler from source code. which is obviously binary machine language.
.
I actually rethought this... probably, if anything, Dave himself would have wanted this to carry on. so... ignore my previous post....
viva la debate.
initialize a float with value zero.
begin a while loop to take character input, and break on newline entered.
in the body of the while loop you will :
--- check if decimal point is entered. if so, keep track of this fact, and continue to get next character
--- convert numeric char to value
--- if value is prior to decimal point, multiply total float value by 10, then add the numeric value
--- if after the decimal point, divide the numeric value by incrementing powers of 10, add the result to the total float value
you will need to perform error checking at all inputs, to ensure no invalid characters are entered.
Daniweb: Thanks for sharing!
______
Spam link here.
.
sadly there are a LOT of professional marketeers here. They're all in the business of generating accounts for their spambots to flood the forums with link spam.
It's no doubt well known by now that Daniweb endorses link spam in signatures and won't do anything about it, so ever more will flock here knowing their messages won't be deleted and will turn up on Google searches for years to come.
yeah, i've been wondering about that, why that is.
it's kind of disturbing actually, and i've been avoiding thinking about the whole issue and it's ramifications. i
i enjoy participating in the forum of my programming-language-of-choice... but the fact that this whole website is really becoming such a spam relay station makes me reconsider whether i should continue to participate here at all anymore.
like, for instance, there's this rule about putting your email or website contact info in your post. it will get snipped and repeats will presumably get you warnings. Yet someone can fill their signature with emails and contact info, and that's perfectly okay?
what kind of hypocritical bullshit is that?
probably wants to get hits at his lame website
you can certainly password-protect files -- and even entire directories.... the easiest way is called "setting permissions" on *nix and windows has an equivalent, and the password protection is your account login. of course if you share an account the issue is moot. you also have no protection against the superuser or root (windows admin).
a more thorough but expensive solution (in time and money) is to get 3rd party encryption software to password-protect entire files and directories. This will stop everyone, up to and including industrial or government forensics agencies if you really want to pay for it.
but here's another, far more likely, possibility: nobody gives a flip about your C-programming homework. so forget about it.
.
unfortunately, the reality is that the snippet quality around here tends to be amateurish if not downright garbage.
so it actually IS "up to snippet level".
and that's the real problem
um, did you try "double-clicking" the file?
.obj files are written in plain text.
one of the major concepts in marketing is demographics. i.e., "understand your audience".
the problem is, that there probably aren't very many professional marketers that frequent this forum. i'd be willing to bet that there aren't any.
see what i'm getting at?
now there are some forums that have to do with internet marketing... i have no idea what goes on over there, i have zero interest in finding out. but i'm thinking perhaps you should have put your thread in one of those
.
Hey! It'sa me, Mario! You clicka my links!
um, St. George, if he even did anything that was said of him, surely wasn't a Brit and didn't do anything for Britain.
so tell me, why do you care?
It's like how Americans get all excited about St. Patrick -- you know, some legendary figure from 1000 years ago, who may or may not have done what is attributed to him, but who definitely had nothing to do with our country.
anyhow, say what you want about our 4th of July. not only does it have no relevance to the discussion here, I don't define my self-image on either the holiday or what other people think about it.
love you, though :)
.
the entire thread, starting from the very first snippet by OP, is crap.
code snippets should not be allowed to be created by anyone with less than 100 posts.
best C socket programming reference ever:
http://beej.us/guide/bgnet/output/html/multipage/index.html
many books are good... so, why is this best? because unlike the other good ones, this one is also free.
we're not going to fix your code for you dude. you're going to do that yourself.
(1) keep track of each number pair you generate by setting the appropriate element in a 10x10 array.
(2) each time you generate a new pair, check and see if your 10x10 array has marked that pair as having already occurred.
(3) if it's already occurred, generate a new pair and repeat #2
(4) if it hasnt already occurred flag the appropriate variable in the array and repeat #1
continue to do this until you have as many numbers as you need.
if you can guarantee non-repetition, then your numbers aren't random.
what i'm wondering is why a marketing student would think that professional marketers hang out in an "IT Professionals Lounge"
I mean, marketers dont have a technical bone in their body. they obviously wouldn't have any idea about a forum .. for ... technical ....
oh. wait. i get it now.
what? another crazed christian zealot ready to throw his life down in order to disrupt society and government?
yeah. like we don't have enough of them running around these days. no thanks.
sorry i didnt understand your limitations.
so ... then use getchar() in a while loop that breaks on a newline.
each successive character retrieved in the while loop increments the length counter and the character's numeric decimal value is added to the total value, after the total value is first multiplied by 10
just like in the example i gave you using the pointer method.
you have all the answers you need to do this, right here in this thread.
.
wow. is this our first very own Daniweb meme? 4chan better look out. Later--
I think he meant C Sharp 101
because that would make MUCH more sense
:icon_rolleyes:
I suggest that this thread be closed, out of respect for the deceased.
Dave Sinkula started this thread and largely kept it going as long as it did.
I don't think there's anything left to say, and it will be troubling to see the spammers and other assorted zealots bumping it every month or two.
I suggest that this thread be closed, out of respect for the deceased.
Dave Sinkula started this thread and largely kept it going as long as it did.
I don't think there's anything left to say, and it will be troubling to see the spammers and other assorted zealots bumping it every month or two.
i am kinda lost too can u change my code which is up and make it correct cause i am confused....
that's not how it works here
shouldn't it be entered as "O" and then "1" since the column is the letter, and in the scanf, your column letter is being entered first.
i see that there can easily be confusion with this because your array is structured such that the row is indicated first, not the column. in the traditional game, the coordinates are called out like "A 1" or "B 2" with the column letter in the first position.
but in any event, even if it is being entered correctly, "O" is the 15th letter of the alphabet (column index = 14), and you dont have that big of an array
or am i missing something?
Is there any other way to do it without using an array? I'm only allowed to use loops and if statements >_>
well, you can do it with spit and duct tape if you want, i suppose.
but if you want to do it in C, you've got to use something. It won't just magically sort itself out for you.
yeah, you can do it without using a #define.
what that does is allow you the flexiblity to easily change the code to do other conversions such as from base2 binary or base16 hex. just delete the define and replace the macro name with 10 if you don't want it.
as for doign it with a pointer (*str), i suppose you can do it with an array (str) instead. i wouldn't ever do it that way. sometimes i wonder if they would do better to teach students pointers first...
I saw the tip posted by a couple of the senior members here. I have started doing equality comparisons this way as a way of reducing program errors.
Basically, it makes the compiler check that you aren't attempting assignment instead of an equality comparison. If you accidentally use assignment, the compiler will flag it as a syntax error because you are attempting to modify a constant.
I had the assignment vs. equality thing bite me just the other day because I didn't do this.
hmm. i'd never heard that before, but i guess it makes some sense... at least theres a legitimate reason. i thought people were doing it just to be clever.
are u sure?i mean what is dim2size and why isn't there dim1size??also my array includes only characters inside...can u transform my code so that the function will return the array?
well have you tried it??
look:
void sin1(char map[][MAX_COLS])
make your prototype and your definition like this. you only have to declare the size of the second index. in the main function, pass in the map directly to your function without recasting it: sin1(map);
because it already is a pointer (to an array).
and no, you dont want to try and return the array. pass it by value as an argument as shown.
first off, get rid of "Fast Learner, Good Listener, Self Starter, Self-Motivated". that is all bullshit. every student in the world puts that crap up, and it means zilch other than to waste space.
the two jobs you had at school dont belong under education, they belong under jobs. if you want to put more in education, summarize a few brief points about 1 or 2 senior level classes (design!) where you accomplished something important and RELEVANT to the job you're applying for
cut out most of the verbiage in your main webdev job description. bring it down to a few bullteted or otherwise highlighted points about WHAT YOU DID, how you did it, and what benefit it provided. short and sweet. resume reviewers look at sometimes hundreds of resumes a day, and they're likely only to read 1/3 of your total content. go ahead and get rid of that 2/3 filler now.
and yeah, say "entered and maintained classified data according to established protocol" or some such.... none of that "if i tole ya i has ta kill ya" crap. :icon_rolleyes: that might impress your little sister, but not anyone in IT.
.
his answer is "Google it". And I have with most of the stuff and found answers, but as I said, I am having trouble with these.
is this your first day on the interwebs?
how hard is this?
hell, i can't even read this thread.
its just assigning the first "num" value (the index i == 0
) to the control variable, "minVal"... you got to start somewhere, right?
but I've got to take exception to if (0 == i)
It is logically correct, but considered poor style.
there's no reason why you should obfuscate your code and decrease it's readability by reversing the standard left->right read direction of the conditional.
the only effect is to startle half the people who read your code, and thoroughly confuse a smaller but significant fraction.
.
for one thing, you're finding a minimum value so call the variable "min" or something. not "max"
remember how when you found max, you started at the lowest possible value and worked up. you set max = 0
and changed it any time the current value was found to be greater than max.
to find the min is just the opposite in every way, you'll start at the highest possible value and work down. you'll set min = INFINITY
(well, not literally) and change it anytime the current value is found to be less than min.
.
well, you don't have a return value.
but i dont know if that's the source of your error code. i don't use Dev C++ so I can't say. I use CodeBlocks (w/ MinGW on windows) or gcc (on linux).
I do recommend CodeBlocks, because it's my preference. I've heard criticisms of Dev-C++ that there are some various compile-related issues, but I've also heard people who love it.
It is important to note that DevC++ hasnt been updated since 2005, despite numerous complaints (many of which may have been user error). CodeBlocks stable release was 2 years ago.
If you try CodeBlocks, be sure to get the binary that includes MinGW.
EDIT: that reminds me... did you get the DevC++ version that comes with MinGW? if you didnt, then who knows how it's being compiled. that could cause the error.
compile errors include:
-- void(main), main requires int return
-- conio, deprecated library unavailable.
-- clrscr, unknown function
-- getch, unknown function
crappy coding style, unreadable, sloppy uses include:
-- no whitespace
-- no indentations
-- scanf
-- <math.h> library.... for what purpose?
given all of the above, i have doubts this will even work correctly. I'm certainly not going to go and fix these problems just to get it to compile properly to find out it's got more problems.
In the future the very least you can do, in a general C language forum, is two simple things:
(1) make sure your completed code COMPILES on any standard C compiler.
(2) make sure your completed code is READABLE without someone having to go through contortions to edit it.
[FAIL]
.
something along these lines, i suppose.
#define NUMBER_BASE 10 // change to other base as needed
while (*str != '\0')
{
++length;
value *= NUMBER_BASE;
value += *str++ - '0';
}
This will not work without a few key lines of code to perform proper initialization, which I purposely removed so this is for illustrative purposes. It also needs a lot of error checking to account for all sorts of potential bad input.
.
The number I'm looking for is valid when it's positive, and nine digits. I used ( (value >= 100000000) && (value <= 999999999) ) first, which worked okay, but did not account for leading zeroes. How do I validate a nine digit number, using only math and no functions, with possible leading zeroes?
if you're making GTE or LTE comparisons, then you're obviously using "value" as a numeric value (probably an integer) and *not* a string.
there are no leading zeros in any value. it's a meaningless concept, as a numeric value, because you could conversely say there are infinite number of leading zeros in every value.
now you can *enter* leading zeros in a number, if you want, but it doesnt change the fact that 000123456 is the *exact same value* as 123456. there are only six digits in this value when expressed as base10. no matter how many zeros were entered.
similarly you can *print* a value with leading zeros, typically done so to format numeric data in an aesthetically pleasing manner. or you can print with leading spaces. It doesn't matter: there's no difference, and the "value" is still the same value, regardless of how it's printed.
printf("[%d]", value); // prints: [123456]
printf("[%09d]", value); // prints: [000123456]
printf("[%9d]", value); // prints: [ 123456]
in every case, value is still 123456. six digits as a base10 number.
the only time leading zeros becomes meaningful is if you are counting the number of …