Welcome to Dream.In.Code
Getting Help is Easy!

Join 131,488 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,839 people online right now. Registration is fast and FREE... Join Now!




Translate this code from C++ to C

 
Reply to this topicStart new topic

Translate this code from C++ to C, i will donate or pay u

punkyu
post 8 Oct, 2008 - 12:25 PM
Post #1


New D.I.C Head

*
Joined: 14 Sep, 2008
Posts: 16

biggrin.gif hello sir/madam

i need a program color coding of resistor code i don't know how to make code because i am absent of this discussion of my class.

this is the output should be.

black - 0
brown - 1
red -2
orange -3
yellow - 4
green - 5
blue - 6
violet - 7
gray - 8
white - 9
silver - 5%
gold - 10%

Enter first color:
enter second color:
enter multiplier:
enter tolerance:
the resistor code is:

our teacher said that we need to use <stdio.h> and <conio.h>

all i need is the code for this using C.

if the code will work pls leave ur Email address so i can pay or donate (if needed).

thank you god bless am waiting for the code. thx ! wub.gif

This post has been edited by punkyu: 8 Oct, 2008 - 12:27 PM
User is offlineProfile CardPM

Go to the top of the page


punkyu
post 8 Oct, 2008 - 01:14 PM
Post #2


New D.I.C Head

*
Joined: 14 Sep, 2008
Posts: 16

up
User is offlineProfile CardPM

Go to the top of the page

punkyu
post 8 Oct, 2008 - 01:34 PM
Post #3


New D.I.C Head

*
Joined: 14 Sep, 2008
Posts: 16

up
User is offlineProfile CardPM

Go to the top of the page

Steven Smith
post 8 Oct, 2008 - 01:50 PM
Post #4


New D.I.C Head

*
Joined: 17 Mar, 2008
Posts: 25


My Contributions


You do not need to bump your post up twice in an hour when it has not even made it off the first page.

Below are the forum rules, with the pieces you violated in bold. You either need to post your attempt at the code, or if you don't know where to start, go talk to to your teacher about getting additional help or dropping the class.
________________

Welcome to the dream.in.code's programming help forums! In order to better help you and other members, there are a couple rules we'd like you to follow:

* Post the code you have so far using the code tags: code.gif. We can't help you if you don't post your code. We will not do your homework for you. You MUST show some effort.
* We have a 0-tolerance cheating policy. If we find you are trying to cheat, you will be warned, and subsequently banned. You MUST show some effort.
* Make your questions and answers clear and concise. Explain the problem, any errors you are receiving, and the code causing the errors.
* Utilize the "Search" feature. Many questions have already been asked and answered in another thread.
* If you are answering someone's question, only do so if they have made an attempt. We will delete any posts providing code when a user has not shown some effort. Kindly ask the user to post what they've done so far.
* If you absolutely must hire someone to do your code, do NOT post in the forums. All correspondence must be over PM or E-Mail.

Following these simple guidelines helps us help you faster and provides others in the future a way to learn. Thank you for your cooperation.

Please, make sure you are also in correspondence with dream.in.code's forum rules.

User is offlineProfile CardPM

Go to the top of the page

punkyu
post 8 Oct, 2008 - 02:41 PM
Post #5


New D.I.C Head

*
Joined: 14 Sep, 2008
Posts: 16

ops sorry i forgot hmm basically i have made mind but i used C++

but our teacher want C even i already finish my c++

all i need to do is to convert c++ to c hers i made off

cpp
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
#define size 4

struct ResistorsValue
{
char ColorBand[10];
int black, brown, red, orange, yellow, green, blue, violet, gray, white; // 0 1 2 3 4 5 6 7 8 9
double gold, silver, none; // +-5% +-10% +-15%
};

//void Function(Resistor*, int, double);

void main(void)
{
int num, num2, i, colors, numcolor1, numcolor2, numcolor3;
double Value;

cout << setprecision(2) << setiosflags(ios :: fixed | ios :: showpoint);

cout << "Enter the number of Resistors value you want to create: ";
cin >> num;
cout << endl;

ResistorsValue *cal = new ResistorsValue[num];

cal.black = 1;

for(i = 0; i < num; ++i)
{
cout << "Enter information for resistor number" << i + 1 << endl;

for(colors = 0; colors < size; ++colors)
{
cout << "Enter color band number " << colors + 1 << ": ";
cin.ignore();
cin.getline(cal[colors].ColorBand,10);
}


/*num2 = 1 * pow(10, numcolor3);
Value = ((numcolor1 * 10) + numcolor2) * num; // This is the equation to calculate the resistor value.
*/

}
}


all i need is to change this to program C
User is offlineProfile CardPM

Go to the top of the page

JackOfAllTrades
post 8 Oct, 2008 - 03:43 PM
Post #6


D.I.C Regular

Group Icon
Joined: 23 Aug, 2008
Posts: 491



Thanked 42 times

Dream Kudos: 25
My Contributions


In other words, you got the code from here, but your class is in C.
User is offlineProfile CardPM

Go to the top of the page

punkyu
post 8 Oct, 2008 - 04:15 PM
Post #7


New D.I.C Head

*
Joined: 14 Sep, 2008
Posts: 16

yups i copy from Sir the hater and it was correct that i submit to my teacher but he also want C T_T can u help me sir? i pay if needed i donate if that will. this is part of my project huhu
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 8 Oct, 2008 - 04:17 PM
Post #8


Working Girl.

Group Icon
Joined: 6 Feb, 2008
Posts: 5,371



Thanked 94 times

Dream Kudos: 2625

Expert In: Dingleberries

My Contributions


1) Please code.gif
2) Since you're looking to pay, I'll move this to "Request a Service"
3) Topic renamed to be more descriptive
User is offlineProfile CardPM

Go to the top of the page

BetaWar
post 8 Oct, 2008 - 04:24 PM
Post #9


#include <soul.h>

Group Icon
Joined: 7 Sep, 2006
Posts: 1,976



Thanked 77 times

Dream Kudos: 1175
My Contributions


Also, please don't rip other people's work. They went through the problems of doing it for their class and you just taking to for your won't lead you to the grade you will want in the class (Most of the time, if a prof/teacher finds out that you have stolen your homework from someone else you get an auto-fail).

As Gabe said, provide YOUR code, not somebody else's.
User is offlineProfile CardPM

Go to the top of the page

no2pencil
post 8 Oct, 2008 - 05:19 PM
Post #10


My fridge be runnin OH NOEZ!

Group Icon
Joined: 10 May, 2007
Posts: 6,283



Thanked 54 times

Dream Kudos: 2375

Expert In: Goofing Off

My Contributions


QUOTE(punkyu @ 8 Oct, 2008 - 04:25 PM) *

our teacher said that we need to use <stdio.h> and <conio.h>

...then I guess I'm out!
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 12:05AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month