15,917,591 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Ron Yehuda (Top 7 by date)
Ron Yehuda
1-Feb-21 14:21pm
View
I want to let you know that I figured it out. I set the total_resistance_denominator to be a double rather than an int but it still gave me a 0 for any number of R other than 1. Then, I cast R1 to be a double in the equation for total_resistance_denominator and I finally got it to print the correct number.
So my code now is:
double total_resistance_denominator = 1 / (double)R1
Ron Yehuda
1-Feb-21 14:13pm
View
I appreciate that, thank you.
Ron Yehuda
1-Feb-21 14:13pm
View
Thank you for the advice I didnt even notice the extra % after %d, it's honestly unfortunate that the newer VS points that out. I'm stuck using this version for the computer science class I am taking.
Ron Yehuda
1-Feb-21 2:38am
View
I'm realizing now, R1 (R2 and R3 which aren't in this code quite yet) need to be int but nothing is said about the total_resistance itself. Would it change anything if I set the that to be a double value?
Ron Yehuda
1-Feb-21 2:37am
View
I agree! Using int was a requirement for R1 from my teacher.
Ron Yehuda
1-Feb-21 2:36am
View
I noticed that it kept saying an error because it was computing 1/0 even when I had R1 as a value other than 1. Why is that the case though? If R1 is 2 why would it be 1/0 rather than 1/2?
In regards to using double over int, I completely agree and I would think to do so as well. Using int for R1 is a requirement for the assignment given by the teacher, I'm assuming for us to troubleshoot the problem I am currently having with my code.
Ron Yehuda
1-Feb-21 2:34am
View
Honestly I agree with what your saying, C is the language I have to learn for the computer science class I need to take for my Mechanical Engineering major. Unfortunately using the #define _CRT_SECURE_NO_WARNINGS is something the teacher has told us to include in every code as its only been a few weeks of class thus far. He's teaching it as more of a, do what I show you and learn what it does later.
Show More