News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Loop

Started by MChristian, September 09, 2016, 03:04:20 PM

Previous topic - Next topic

MChristian

Hi, my name is Marquis.  I took a C programming class at ITT Technical  as you heard they lost their accreditation.

Will I have been working on a program for Max Power Transfer.  The program run but i want it to do one more step that i was not taught.

Loop back to the beginning and ran again.  Yesterday, I toyed with it and got it working and from lack of experience I did not save a copy once it work and continued to play with it until I'm lost.  I thank I did good for one semester in programming.  I hope to continue learning as I have been in the Electronics field for over 30+ years.

I have attached the program, Will you help me?

Thanks, in advance!

tanel

You may try to compile attached file. switch statement block was commented out and main calculation body is taken into do-while block. you can see the diff in the file since I did not change structure.

MChristian

Can any one help with this program?

I work and get stuck.

1.The program should test for Max power across R2 and Load
2. I compared R2 to Load for Max Pwr
3. I want it to repeat
4. Im not sure the power statement is correct, I want to automatic test and print Max power...Is that asking too much?

Thank in advance!

tanel

I would recommend you to use a tool like Pelles C to write a code instead of Word. And using indentation icreases the readability. The attached file is Project folder that includes  c source, Project files and executable. Looks like it works as you stated.

I don't know if the power formulation is correct. R1 is defined but not used. If it is not needed, I think power formula is OK.


MChristian

Thanks for your assistance!.  I did copy this file into word but it was written with Pelles.  How do I submitt it the way  you are describing?  This site is a little differant for me .  How do I attach files here or can I?

tanel

if you put project folder or c, h, ppj files into a  compressed file (like .zip, .7z or .rar), it would be easy to attach a single file. Having project files makes life easier (at least for me).

In the meantime, I wonder the function of R1


MChristian

Okay, thanks I will try that!

Bitbeisser

Quote from: MChristian on September 21, 2016, 10:30:41 PM
Okay, thanks I will try that!
Did you try that?

Creating such a ZIP file of your project is as simple as right-clicking on the project's .EXE name in the project pane (right hand side) and select "ZIP project files"...

Ralf