Pelles C forum

C language => Beginner questions => Topic started by: MChristian on September 09, 2016, 03:04:20 PM

Title: Loop
Post by: MChristian on September 09, 2016, 03:04:20 PM
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!
Title: Re: Loop
Post by: tanel on September 09, 2016, 04:58:06 PM
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.
Title: Re: Loop
Post by: MChristian on September 19, 2016, 02:58:35 AM
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!
 
Title: Re: Loop
Post by: tanel on September 20, 2016, 09:04:37 PM
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.

Title: Re: Loop
Post by: MChristian on September 20, 2016, 09:28:28 PM
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?
Title: Re: Loop
Post by: tanel on September 21, 2016, 09:57:11 PM
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

Title: Re: Loop
Post by: MChristian on September 21, 2016, 10:30:41 PM
Okay, thanks I will try that!
Title: Re: Loop
Post by: Bitbeisser on January 15, 2017, 01:45:51 AM
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