Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a C++ Expert!

Join 244,297 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 861 people online right now. Registration is fast and FREE... Join Now!




Res color calculater

 
Reply to this topicStart new topic

Res color calculater, please alitll help

kokita
30 Dec, 2008 - 04:19 AM
Post #1

New D.I.C Head
*

Joined: 30 Dec, 2008
Posts: 5

wink2.gif we have this assignment in object oriented , that we have to design a resister calculate it calculate the color and the most neer value of any value you inter it will correct the value and output the corresponding color mached with the corrected value
if there is any body to help me pleas
i don't know even how to start
i have to inter value the program must figure out the most neer correct value and it is corresponding color
using E12 series


This post has been edited by kokita: 30 Dec, 2008 - 11:29 AM

User is offlineProfile CardPM
+Quote Post


JackOfAllTrades
RE: Res Color Calculater
30 Dec, 2008 - 04:24 AM
Post #2

Cantankerous Old Fart
Group Icon

Joined: 23 Aug, 2008
Posts: 3,055



Thanked: 270 times
Dream Kudos: 50
Expert In: Nothing. Well, nothing relevant here anyway. ;)

My Contributions
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is offlineProfile CardPM
+Quote Post

AmitTheInfinity
RE: Res Color Calculater
30 Dec, 2008 - 04:26 AM
Post #3

C Surfing ∞
Group Icon

Joined: 25 Jan, 2007
Posts: 1,258



Thanked: 64 times
Dream Kudos: 125
My Contributions
This and this tells you how to calculate resistance of a resistor from color codes. now all you need to do is take color code input from user. Use method given in above links to calculate resistance and print it.

But if you want code for it then please see here first.
User is offlineProfile CardPM
+Quote Post

kokita
RE: Res Color Calculater
30 Dec, 2008 - 06:57 AM
Post #4

New D.I.C Head
*

Joined: 30 Dec, 2008
Posts: 5

Sorry guys i didn't realize that <,,,, i am new here
i will post my code as soon as possible
thanks for you attending
User is offlineProfile CardPM
+Quote Post

kokita
RE: Res Color Calculater
30 Dec, 2008 - 08:51 AM
Post #5

New D.I.C Head
*

Joined: 30 Dec, 2008
Posts: 5

hi this is my code
i hope that any body would help me i dont know what to do scince i am abegineer but i would love to learn



CODE
#include<iostream>
using namespace std;

class Res
{
private: //attributes
    int k,i,j;
    float x,value[12];
    long getcolor;
    long colorcode;
    long colorcalue;
char again,r_color;                        
public: //methods
    Res() {} //constarctor
    ~Res() {} //decostractor
    void input(void);
    void getcolor(void);
    void spcialue(void);
    void displayit(void);
};


void Res::input(void)
{
    
cout<<" inter the value you want to know the corresponding color code for it ";
cin>>x;

}
                                  


void Res::displayit(void)
{
    

cout<<" the Color code is ";
cout<< r_value;

}

void Res::getcolor(void)
{
for( i = 0; i < 3; i++)
{
    switch (colorvalue[i])
    {
        case('0'):            
        case('1'):                
            colorcode[i] = 'B';                
            break;
        
        case(1):            
        case(10):                
            colorcode[i] = 'N';                
            break;
        case(2):            
        case(100):                
            colorcode[i] = 'R';                
            break;
        case(3):            
        case(1000):                
            colorcode[i] = 'O';                
            break;
        case(4):            
        case(10000):                
            colorcode[i] = 'Y';                
            break;
        case(5):            
        case(100000):                
            colorcode[i] = 'G';                
            break;

        case(6):            
        case(1000000):                
            colorcode[i] = 'L';                
            break;
        case(8):                          
            colorcode[i] = 'E';                
            break;
            
        case(9):                
            colorcode[i] = 'W';                
            break;

            default: break;
    }
}


for( j = 0; j < 8; j++)
{
    switch (colorCode[3])      
    {  
        case('B'):        
            multiplier = 1;      
            break;

            case('N'):        
            multiplier = 10;      
            break;
            case('r'):        
            multiplier = 100;      
            break;
            case('O'):        
            multiplier = 1000;      
            break;
            case('Y'):        
            multiplier = 10000;      
            break;
            case('G'):        
            multiplier = 100000;      
            break;
            case('L'):        
            multiplier = 1000000;      
            break;
            case('E'):        
            multiplier = 10000000;      
            break;
            //case w not implemented
            default: break;
    }
    r_color = ((colorcode[0] + (colorcode[1]) + (colorcode[2])) * multiplier);










void main (void)
{
    Res numbers;
    numbers.input();

    numbers.displayit();
}



This post has been edited by kokita: 30 Dec, 2008 - 11:26 AM
User is offlineProfile CardPM
+Quote Post

polymath
RE: Res Color Calculater
30 Dec, 2008 - 09:01 AM
Post #6

D.I.C Addict
Group Icon

Joined: 4 Apr, 2008
Posts: 614



Thanked: 17 times
Dream Kudos: 500
My Contributions
please code.gif
User is offlineProfile CardPM
+Quote Post

kokita
RE: Res Color Calculater
31 Dec, 2008 - 03:01 AM
Post #7

New D.I.C Head
*

Joined: 30 Dec, 2008
Posts: 5

please any one can help me out here
User is offlineProfile CardPM
+Quote Post

JackOfAllTrades
RE: Res Color Calculater
31 Dec, 2008 - 05:40 AM
Post #8

Cantankerous Old Fart
Group Icon

Joined: 23 Aug, 2008
Posts: 3,055



Thanked: 270 times
Dream Kudos: 50
Expert In: Nothing. Well, nothing relevant here anyway. ;)

My Contributions
You haven't even told us what is the problem.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic

Time is now: 7/4/09 04:44PM

Live C++ Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month