Re: My problem in C

2020-09-26 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C In that case that's all this is.  C doesn't have any "special" types.  A file * is a pointer to file, and a file is either a struct or a typedef of one of the built-in types provided by your implementation.  That is to say that you shouldn't ever assume tha

Re: My problem in C

2020-09-26 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C I have no problems with passing pointers around, though I think I should refresh the structures a bit. URL: https://forum.audiogames.net/post/574499/#p574499 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin

Re: My problem in C

2020-09-26 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C I can't do C file I/O offhand, but you can just:int myFunc(file *file) { // do stuff to the file here }and it'll work fine.  There's nothing that makes a file special.  If you understand how to pass pointers to functions, you understand how to pass pointers to files

Re: My problem in C

2020-09-26 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C Okay, this is more of a general question, (Of which I didn't got any answer from google,):I have seen many examples of deligating the tasks to a function, but I haven't come across for a file i/o.I am more specifically talking about creating a function, which creates

Re: My problem in C

2020-09-21 Thread AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
Re: My problem in C @118 my reply wasn't a criticism of what you said in your post. as I state in the post, I just wanted to present how other languages on the JVM have been developed to fix the sort of problems you listed with Java, using Scala as an example.the only two corrections I put

Re: My problem in C

2020-09-21 Thread AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
Re: My problem in C @118 my reply wasn't a criticism of what you said in your post. as I state in the post, I just wanted to present how other languages on the JVM have been developed to fix the sort of problems you listed with Java, using Scala as an example.the only two corrections I put

Re: My problem in C

2020-09-20 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C @119If you don't know how this works, it would be a *very* good idea for you to find some math resources, because it's the kind of thing school teaches when you're 10 or so.  I'm afraid I don't have anything at that level, but you should know these rules from

Re: My problem in C

2020-09-20 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C Okay, I managed to solve this one.admittedly, I am not very good with signs in math. there... are many reasons for it, I won't boar you with them though don't worry. URL: https://forum.audiogames.net/post/572487/#p572487 -- Audiogames-reflector mailing list

Re: My problem in C

2020-09-20 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C @115You can indeed just use -x.  But the actual problem isn't operator precedence, it's that if you multiply a negative number by 1 then you just get the negative number.  If you want to do it as a multiplication, you always multiply by -1. That's not a programming

Re: My problem in C

2020-09-20 Thread AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
Re: My problem in C also as an unrelated post, I just checked the last pages of this thread now and can't help but respond to @104I'm sure you are aware that there are languages other than Java that run on JVM, notably Scala and Cotlin. I wrote Scala professionally for a year and have

Re: My problem in C

2020-09-20 Thread AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
Re: My problem in C this is very simple. just put a - before the number. let's say your number is stored in a variable x, then - x will give you the "opposite" number.alternatively, multiply your number with -1, like x * -1to give a explanation why your way didn't wor

Re: My problem in C

2020-09-20 Thread AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
Re: My problem in C this is very simple. just put a - before the number. let's say your number is stored in a variable x, then - x will give you the "opposite" number.alternatively, multiply your number with -1, like x * -1to give a explanation why your way didn't wor

Re: My problem in C

2020-09-20 Thread AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
Re: My problem in C this is very simple. just put a - before the number. let's say your number is stored in a variable x, then - x will give you the "opposite" number.alternatively, multiply your number with -1, like x * -1 URL: https://forum.audiogames.net/post/57241

Re: My problem in C

2020-09-20 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C So, does anyone knows how can I convert a number into the opposite number?What I do have to do is get a number, and depending whether it is negative or positive, convert it to the opposite one.As an example, if I had the number 7, then I should return the number -7.I

Re: My problem in C

2020-08-16 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: My problem in C As for compiling with WSL, I have code in my path, so launching WSL and typing code . worked for me. It took a bit to open (VS Code needed to download some things) but after that I was able to edit files in WSL. It may take further investigating as to how to link VS

Re: My problem in C

2020-08-16 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: My problem in C As for compiling with WSL, I have code in my path, so launching WSL and typing code . worked for me. It took a bit to open (VS Code needed to download some things) but after that I was able to edit files in WSL. It may take further investigating as to how to link VS

Re: My problem in C

2020-08-16 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: My problem in C As for compiling with WSL, I have code in my path, so launching WSL and typing code . worked for me. It took a bit to open (VS Code needed to download some things) but after that I was able to edit files in WSL. It may take further investigating as to how to link VS

Re: My problem in C

2020-08-16 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C When people say add to your path, they're referring to the PATH environment variable (all caps).  Surprisingly this is mostly the same on all platforms, save that on non-windows you separate entries with : instead of ;.  All entries in PATH should be directories.  When

Re: My problem in C

2020-08-16 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C Okay, I do want to clear somethings:Should I add the entire bin folder into the environment? or the cl-clang.exe would do?And, should I create a new variable? or a create a new one? URL: https://forum.audiogames.net/post/562050/#p562050 -- Audiogames-reflector

Re: My problem in C

2020-08-16 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C You want to compile with clang-cl which is at c:\program files\llvm\bin, which you can add to your path.  This uses the switches that cl.exe (Microsoft's compiler) uses and injects all the stuff Microsoft's headers expect, but actually calls clang.I don't use VSCode

Re: My problem in C

2020-08-16 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C Okay, few problems, again which are not related with code:As camlorn suggested in post 90, I got the workload, installed clang, ran the x64 native tools command prompt...But what more I should do to run clang? It is not running currently, or at least I don't see

Re: My problem in C

2020-06-01 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C @107:It is nice that you mentioned this book. I always wanted this one, but forget the title again and again. URL: https://forum.audiogames.net/post/535623/#p535623 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https

Re: My problem in C

2020-05-31 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C @107It's not unreasonable to learn just enough C++ to do basic classes and use std::vector, then write all of your code like it's C with just a bit of C++ in there to make your life easier in the places where C falls short.If I was forced to choose between C or C

Re: My problem in C

2020-05-31 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: My problem in C @camlorn, thank you for the educational response and for showing how much I don't know, LOL. Sorry for a rather late response, I forgot to look at this topic. I don't think I will touch CPP, then, mostly because there is no point in me doing so right now. I

Re: My problem in C

2020-05-27 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C @105C# has accessibility issues of a sort in that you're at the mercy of Microsoft to keep Visual Studio accessible, and anyone who's been programming for long enough remembers 2010 when it became inaccessible for 5 years or so, and 2015 when it was accessible

Re: My problem in C

2020-05-27 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C Very nicely put. I think when you refered to green threads and, you were talking about the multithread programming. you would be right that I still don't know much about it yet.Also, interesting that you mentioned c#, I remember someone once put c# as the java

Re: My problem in C

2020-05-27 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C @103So first let me say that my thoughts on Java are opinions.  Some people disagree.And also let me say that Java is a language on the JVM, and that the JVM is (mostly) okay as a runtime.That said:You can tell a lot about a language without even knowing

Re: My problem in C

2020-05-27 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C I am aware of that issue. until few months ago, I thought that it was over, but then it began all over again, and all the people who have no understanding of programming or how things work, decided to chip in.Also, can you elaborate why exactly is java is so bad? you

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C @101In the U.S. a hell of a lot of people learn Java and stick with it.  That's definitely not unique to any country.  It's kind of a shame though, especially since Oracle may be about to literally change the face of the entire tech industry for the worse for the sake

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C I think that it doesn't have many jobs yet is because rust has yet to trickle down to more general companies, aside from the tech giants which you have mentioned.Once that happens, there will be more jobs for this language.What I can tell you though, that here in India

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C @96yeah, programming usually always works out to be whatever the 6 figures equivalent of the local economy is.Also Rust is used by at least Dropbox, Google, Cloudflare, Amazon, and Microsoft.  It's valuable to know.  It just depends a lot on what your motivation

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C Well, I am not actually in the US, but I am sure that I can find a nice job in the node.js here in India as well.as for rust, I don't think I would learn it to use it on a job, it is just a way for either to learn something new when I have nothing else to do, or just

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C @97Node.js won't be a problem with respect to getting a job in it. If you're in the U.S. that'll be 6 figures after a couple years at most and you can probably learn the basics very quickly.Do notice that I said you might consider Rust if you want a higher level systems

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C @95:Props for asking a nice question, which post 96 explained very nicely.While I will move to JS for now, I do think I'll learn c++ in the future, as well as rust. Because I do have interest in them.Meanwhile, I think it would be great for me if I try to get a job

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C @95For motivation as to why C++ is better, look up std::shared_ptr, which prevents memory leaks through use of copy constructors and destructors to do reference counting without you having to make sure you put all the calls in the right place, and also helps you avoid

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: My problem in C @camlorn, I'll bight, since I was always curious.If C is only used in some specific situations, what about C++? Why is it more, or less, applicable than C? This is more of a theory question to which I tried to find an answer but failed, and I'm hoping you can clear

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C _javascript_ is easy and a good choice.  Some of the stuff around webpack and such is a little bit fiddly, but overall I actually like the language quite a lot these days.  It used to be kind of lame, and then they fixed the lameness 4 or 5 years ago and now it's kind

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C In that case, I think I should switch to _javascript_, I have worked through the basic tutorials from the modern _javascript_, and so far I have found this language to pick up easy.Of course I am sure as things get advance, I would find some hard things in _javascript_

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C @91Half seriously, switch languages to something easier and learn to program in general.  Overall C isn't worth the frustration unless you're trying to do something that specifically needs it and if you're past the point where you've learned the basics then you're past

Re: My problem in C

2020-05-26 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C @camlorn:Thanks for the steps, I think I should be able to get clang now.Also, do you have any recommendations for taking my knowledge of c to next level? I am done with the basics, finished the Stephen prata's book, and I do think that I can mostly solve the basic

Re: My problem in C

2020-05-25 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C First, if you just want to be able to build C stuff and it's not Windows specific your best bet is to install WSL. Then type bash at any command prompt and you have a working Linux environment that can access Windows files.  You can apt-get install clang

Re: My problem in C

2020-05-25 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C No, for now I won't bother you guys with a coding problem (At least for now.)Instead, there is a different question I have which I hope one of you could answer.I am thinking of acquiring clang for my system.I am using windows 10, and I actually have tried the getting

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C @87, whitespace characters are entirely insignificant. They are only relevant for steps 1-4 of the theoretical compilation model outlined in section 5.1.1.2 of the C standard. By step 7 they are completely eliminated. The only reason I can see that particular compiler

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C @87, whitespace characters are entirely insignificant. They are only relevant for steps 1-4 of the theoretical compilation model outlined in section 5.1.1.2 of the C standard. By step 7 they are completely eliminated. The only reason I can see that particular breaking

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : Mitch via Audiogames-reflector
Re: My problem in C You could always initialize another int to be (b + C). Then, you might not  have  issues. I myself am using Gcc for my classes, so I'm not familiar with Clang itself, but try that. @86, whitespace is usually ignored, but it may not be on the website that he is using

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C That's worth a try but whitespace usually has no effect on the placement of operators -- whitespace is ignored (nearly all the time). URL: https://forum.audiogames.net/post/522332/#p522332 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : stewie via Audiogames-reflector
Re: My problem in C You have a space after the * but not before (that is, you have a* (b+c)). Try doing a*(b+c) or a * (b + c) URL: https://forum.audiogames.net/post/522319/#p522319 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : stewie via Audiogames-reflector
Re: My problem in C You have a space after the * (that is, you have a* (b+c)). Try doing a*(b+c) or a * (b + c) URL: https://forum.audiogames.net/post/522319/#p522319 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C That's... weird. I wonder how they're invoking it? I invoke mine as:clang -Wall -Wextra -o file.exe/file file.c URL: https://forum.audiogames.net/post/522295/#p522295 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C @Ethin:As far as I know, there aren't any options to change the compiler on the site itself. I think I would need to file this under the bug report.Edit: There is the option to use clang 8/ c 18, (Which I did not saw since there was no button or clickable element

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C @Ethin:As far as I know, there aren't any options to change the compiler on the site itself. I think I would need to file this under the bug report. URL: https://forum.audiogames.net/post/522274/#p522274 -- Audiogames-reflector mailing list Audiogames-reflector

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C @81It might if the compiler is bugged. URL: https://forum.audiogames.net/post/522248/#p522248 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C @80, that wouldn't help. The original code is valid.@Dark Eagle, this compiles under C11 and C18 mode under Clang 10.0. I'm surprised they're using such an old clang version; can you get them to use a later version of clang? URL: https://forum.audiogames.net/post

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: My problem in C Did changing the code to the one I proposed in post 75 help? URL: https://forum.audiogames.net/post/55/#p55 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C Clang 3.6 is quite, quite old.  I wouldn't be surprised if there's a bug.Also this wouldn't be the first time one side or the other has had a non-breaking space or something that screen readers can't indicate that screws things up.But either way the code is valid. URL

Re: My problem in C

2020-04-24 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C They use clang 3.6/ c 11.Also, aside from the main function, the code I have given here does not differ from the code I am using there. URL: https://forum.audiogames.net/post/522115/#p522115 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin

Re: My problem in C

2020-04-23 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: My problem in C Yeah, my guess is also they use a buggy C compiler.  That or somehow the version you've entered on the web site and the version you've given us vary in some subtle fashion.  Do they tell you what C compiler they use? URL: https://forum.audiogames.net/post/522045

Re: My problem in C

2020-04-23 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C I have no idea why their online compiler is doing this. The compiler may not be standards-compliant (this builds under clang v. 10.0.0, which is standards-compliant). There is no syntactical errors in this code. Your code doesn't return from all control paths though, so

Re: My problem in C

2020-04-23 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: My problem in C I think what is happening is that the compiler on their end could be trying to evaluate the B + C part as a pointer.  Perhaps try changing the offending line to something like this? int temp = a;temp *= (b+c);d = temp; Alternative way is to figure out the result of BNC

Re: My problem in C

2020-04-23 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C So I was trying to solve this problem about evaluating expressions on CodeWars, and I did actually managed to code the solution.Except that the solution I coded is giving me an error with which I am unfamiliar with, (The error is described below,) and I am not sure how

Re: My problem in C

2019-11-21 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector
Re: My problem in C I use notepad as well.notepad2 might make you faster on code indentation as it has auto indenting, but that depends on the familiarity you have with indenting.If I have to compile small  c projects I tend to use gcc or g++ if I am working with c++. If not I just use

Re: My problem in C

2019-11-21 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector
Re: My problem in C Notepad is fine, In fact, I'm using it myself all the time, or at least a close alternative, Notepad2 right now. Some IDEs may be accessible and helpful, but I didn't find one I liked to use yet. The accessible ones like Eclipse tend to be rather slow compared to simple

Re: My problem in C

2019-11-21 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C Thanks. next time when I need help, and when I will put my code here, I will try to format it to best of my ability. just tell me whether I did it correctly or not.As for ides, I haven't used an ide for my entire c learning. it has been always like this: type the code

Re: My problem in C

2019-11-20 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector
Re: My problem in C Ethin is right, even though you're blind, indentation should become normal for you. Some programming languages like Python require you to indent properly, because they don't have blocks and the indentation decides upon the code execution for you. Its simply a matter

Re: My problem in C

2019-11-20 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C @68, no, indentation is not impossible. Set your editor to convert tabs to spaces (or just use tabs). For each {, indent by one tab/x amount of spaces for each line within the block. For each }, remove one level of indentation. Maintain indentation levels as best you

Re: My problem in C

2019-11-20 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C Thanks Hijacker. strings is the topic which I have the least amount of knowledge, of course I am rectifying this. hope you guys would still be patient with me by the time I am done with strings.Also, any tips for formatting my code? indentation and such are impossible

Re: My problem in C

2019-11-20 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector
Re: My problem in C Hi,you forgot to reset almost all variables on every for loop cycle. I'd recommend to always replay your algorithm on paper to see if it works or doesn't, and always just stick to the code you wrote, not how you'd like it to actually work. You'll notice, that temp

Re: My problem in C

2019-11-20 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector
Re: My problem in C Hi,you forgot to reset almost all variables on every for loop cycle. I'd recommend to always replay your algorithm on paper to see if it works or doesn't, and always just stick to the code you wrote, not how you'd like it to actually work. You'll notice, that temp

Re: My problem in C

2019-11-20 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C So, in a problem to count vowels within a string, I must test multiple strings, and count the vowels present within them.The issue is, the code below does not tests the entire string, it exits after finding one vowel, and it only tests one string, doesn't matter whether

Re: My problem in C

2019-10-15 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C @64, no problem. I understanding having too much to do and not enough time to do it (college, much?). URL: https://forum.audiogames.net/post/468635/#p468635 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin

Re: My problem in C

2019-10-15 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector
Re: My problem in C Sorry. replace the printf statement with this oneprintf("the result is %f\n", result);@62 thanks for taking the time to explain this, I was in a hurry when I posted the code and didn't explain as detailed as I had to. URL: https://forum.audiogames.net/p

Re: My problem in C

2019-10-15 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C @Ethin:thanks for the explanation.@pauliyobo:I think I can handle the problem through typecast, since these are not the things with which I have a lot of practice, the experience will be good for me. URL: https://forum.audiogames.net/post/468614/#p468614

Re: My problem in C

2019-10-15 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C @61, appologies if I overwhelm you -- that is not my intent.The _expression_ if(result != (int)result && result > 0.0) determines if the floating point number has a fractional part. The fractional part is the number after the decimal point. So if we had a

Re: My problem in C

2019-10-15 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C @61, appologies if I overwhelm you -- that is not my intent.The _expression_ if(result != (int)result && result > 0.0) determines if the floating point number has a fractional part. The fractional part is the number after the decimal point. So if we had a

Re: My problem in C

2019-10-15 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C @pauliyobothanks for the answer. this will be the first time when I would use any other header file except for stdio. guess that is what happen when you move forward.I ran your solution, and the compiler gives me the warning that the format string %d requires

Re: My problem in C

2019-10-15 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C @pauliyobothanks for the answer. this will be the first time when I would use any other header file except for stdio. guess that is what happen when you move forward.one thing though, if it is not too much of a bother, would you mind explaining the condition below

Re: My problem in C

2019-10-15 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C Thanks for clearing that up -- I thought my solution was the one. URL: https://forum.audiogames.net/post/468576/#p468576 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo

Re: My problem in C

2019-10-15 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector
Re: My problem in C This should work#include #include int main(void){int i, n;long dividend, divizer;double  result;printf("Enter the numbers of pairs which you wish to divide:");scanf("%d",);for(i=0;i{printf("Enter the numbers for divide:");scanf("

Re: My problem in C

2019-10-15 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector
Re: My problem in C This should work#include #include int main(void){int i, n;long dividend, divizer;double  result;printf("Enter the numbers of pairs which you wish to divide:");scanf("%d",);for(i=0;i{printf("Enter the numbers for divide:");scanf("

Re: My problem in C

2019-10-15 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C @pauliyobo:Here's the code:#include int main(void){int i, n;long result, dividend, divizer;printf("Enter the numbers of pairs which you wish to divide:");scanf("%d",);for(i=0;i{printf("Enter the numbers for divide:");scanf("%d%d"

Re: My problem in C

2019-10-14 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector
Re: My problem in C @55 Hello.Could you post the entire code?If not, of which type is result? URL: https://forum.audiogames.net/post/468438/#p468438 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman

Re: My problem in C

2019-10-14 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C Give this a try:#include // ... if (val != (int)val) { // check for fractional part float iptr; float integral_part = modf(val, ); if (iptr > 0.5) { val += 0.5; } else if (iptr < -0.5) { val -= 0.5; } }It may not work on the else condition; the docs say:C++ Ref

Re: My problem in C

2019-10-14 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C Give this a try:#include // ... if (val != (int)val) { // check for fractional part float iptr; float int = modf(val, ); if (iptr > 0.5) { val += 0.5; } else if (iptr < -0.5) { val -= 0.5; } }It may not work on the else condition; the docs say:C++ Ref

Re: My problem in C

2019-10-14 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C In this problem, I have to divide two numbers, and if there is a fractional part in the result, ad0.5If it is positive, or minus0.5If negative.The final result which would be printed is a truncated intijer, with the 0.5 added to it.Aside from that, if the result

Re: My problem in C

2019-10-07 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C @52, I did already say it was overcomplicated... but it is a good way of killing two birds with one stone. He can learn algorithms/data structures as well as this at the same time. URL: https://forum.audiogames.net/post/466621/#p466621 -- Audiogames-reflector

Re: My problem in C

2019-10-07 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C Thanks again, guys. URL: https://forum.audiogames.net/post/466611/#p466611 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: My problem in C

2019-10-05 Thread AudioGames . net Forum — Developers room : stewie via Audiogames-reflector
Re: My problem in C The above code is overly complicated and less efficient than a simple solution. You absolutely do not need a complicated sorting algorithm to find the minimum and maximum numbers in an array (besides, heapsort is O(n log n) and finding minimum and maximum of an array

Re: My problem in C

2019-10-05 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C Though there is a min, max, and minmax function in the C++ stdlib, your problem is in C, not C++. This is where a nice sorting algorithm comes into play. I will take the code from this page on RosettaCode and implement it into your program to show you how you would do

Re: My problem in C

2019-10-05 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C Though there is a min, max, and minmax function in the C++ stdlib, your problem is in C, not C++. This is where a nice sorting algorithm comes into play. I will take the code from this page on RosettaCode and implement it into your program to show you how you would do

Re: My problem in C

2019-10-05 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C So, I am trying to find the largest and the smallest value within an array. but the program spits out random values after the input is done.Below is the source code, take a look at it, and please tell me what I am doing wrong.#include int main(void){int i, n;long list

Re: My problem in C

2019-09-19 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector
Re: My problem in C Ternary is absolutely fine in certain situations. You shouldn't use it in e.g. nested if situations, it will just mess things up, but in the above situation, where a single function should just return values depending on the input and there are just two outcomes

Re: My problem in C

2019-09-18 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C thanks for your pacients in explaining guise.I tried the scanf situation by creating a small program. I actually was unsure regarding scanf taking negative numbers, because the input contains a character in the form of a dash. but all of my doubts are quelled.@Ethin:I

Re: My problem in C

2019-09-18 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: My problem in C I highly discourage use of the tirnary operator. It is trivial to make mistakes with it and makes your code harder to understand (especially with complex expressions). Just use normal if/else if/else/... as much as possible and avoid the tirnary. URL: https

Re: My problem in C

2019-09-18 Thread AudioGames . net Forum — Developers room : stewie via Audiogames-reflector
Re: My problem in C Scanf does support negative number inputs. The same format specifiers (for the most part) that you'd pass to printf work for scanf in the same way. If you use %d (specifier for a normal signed int) it'll work. URL: https://forum.audiogames.net/post/462630/#p462630

Re: My problem in C

2019-09-18 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: My problem in C While I haven’t work with the language, if it already excepts normal Numbers, there is no reason that the method you are using should not accept negatives. URL: https://forum.audiogames.net/post/462628/#p462628 -- Audiogames-reflector mailing list Audiogames

Re: My problem in C

2019-09-18 Thread AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
Re: My problem in C Thank you guise for your quick answers.One last thing which I would like to know is that, if I get a user to enter the number, will scanf take the negative number?feel free to rage if it is a stupid question. URL: https://forum.audiogames.net/post/462625/#p462625

Re: My problem in C

2019-09-18 Thread AudioGames . net Forum — Developers room : bgt lover via Audiogames-reflector
Re: My problem in C I knew something wasn't quite right.By the way, thank you for rembering me how to use that operator.As I said above, I didn't write the code in a simpler way because of my phone's touchscreen keyboard. URL: https://forum.audiogames.net/post/462598/#p462598

Re: My problem in C

2019-09-18 Thread AudioGames . net Forum — Developers room : stewie via Audiogames-reflector
Re: My problem in C That code isn't quite right, the tirnary comparison thing is an _expression_ so you should return the whole thing, also it's written differentlyint minimum(int a, int b) {    return a < b ? a : b;}You don't need to do it this way, the more simple case is perfec

Re: My problem in C

2019-09-18 Thread AudioGames . net Forum — Developers room : bgt lover via Audiogames-reflector
Re: My problem in C It is actually verry easy, the same as with positive numbers.int compare(int a, int b)aOffcourse this bit of code may be wrong, especially my use of the turnary operator, but I wrote this code the way it is because I am on the phone and don't know where the braces

Re: My problem in C

2019-09-18 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector
Re: My problem in C Its just the same as before. As long as you're using a signed datatype like int, long or whatever instead of unsigned int, unsigned long (uint, ulong) etc. the well-known less than or greater than operations work fine.int a = -256; int b = a - 3; if(b < a) printf(

  1   2   >