CARI Infonet

 Forgot password?
 Register

ADVERTISEMENT

View: 2658|Reply: 7

to ALL PROGRAMMER!! help ME!!

[Copy link]
Post time 30-8-2006 12:49 AM | Show all posts |Read mode
aku ade kene uat asgment nih..
aku buat program nie .. untuk convert2 .. tp yg peliknyee bile aku compile die kuar mcm ni:nih output die::



Welcome to MARKOVNIKOV METRIC CONVERSION zone!!


Enter sentence like "x grams in kilograms?":1 millimeters in meters

1.000000 millimeters = 1.000000 millimeters



bile aku letak ape2 convert jer.. mcm centimeters ke, inchi ker.. die tetap nak kuar millimeters gak.. sape2 yg tererr boleyy tak btolkan kesilapan aku nih..
nih code yg aku uat..
nih cume sikit jer




#include <stdio.h>

int main()

{


    int metric1, metric2, millimeters, centimeters, meters, kilograms;
    float x;
   
    printf("Welcome to MARKOVNIKOV METRIC CONVERSION zone!!\n\n\n");
   
    printf("Enter sentence like \"x grams in kilograms?\":");
    scanf("%f %d %d", &x, &metric1, &metric2);
   
    if ( (metric1 = millimeters) && (metric2 = millimeters))
        printf("\n%f millimeters = %f millimeters\n", x, x);
        

    else if((metric1 = millimeters) && (metric2 = centimeters))
        printf("\n%f millimeters = %f centimeters\n", x, x/10);
        
   
    else if((metric1 = millimeters) && (metric2 = meters))
        printf("\n%f millimeters = %f meters\n", x, x/1000);
   
    else if((metric1 = millimeters) && (metric2 = kilograms))
        printf("\nInvalid Conversion\n");
        
        
    return 0;
   
}
Reply

Use magic Report


ADVERTISEMENT


Post time 30-8-2006 09:51 AM | Show all posts
banyak salah ni...

1. variable millimeters, centimeters, kilometers, meters tak ada definition
2. macam mana dia nak tau millimeters, centimeters etc just from a string input? (kena test nihehe)
3. your if statement salah. sepatutnya metric1 == millimeters, bukan metric1 =  millimeters (cuba tengok apa bezanya)

u nak buat conversion program, tapi ni macam ambik orang lain punya kerja aje... coding pun tak complete

a much better implementation is to have a menu-based system to select units to convert, then enter the value, then convert the value
Reply

Use magic Report

 Author| Post time 30-8-2006 03:05 PM | Show all posts
hmm.. ye ke..



1. variable millimeters, centimeters, kilometers, meters tak ada definition <<- nak definition pki ape?? bukan dah declare ke?? boley bg contoh x yg lebey jelas?




2. macam mana dia nak tau millimeters, centimeters etc just from a string input? (kena test nihehe)<-- entah... rase2 belom blaja kot .. tp kene siapkan asgment b4 blaja .. nih nk pki STRING ke??yg #include<string.h>?? kene pki array skalik x?


u nak buat conversion program, tapi ni macam ambik orang lain punya kerja aje... coding pun tak complete <--- mmg x complete.. nih yg siket je.. x amek org laen lerr.. uat sendirik

a much better implementation is to have a menu-based system to select units to convert, then enter the value, then convert the value <--maksudnye???

boley x bg contoh sikit??
tq..
Reply

Use magic Report

Post time 30-8-2006 05:32 PM | Show all posts
begini contohnyer adik2.....
belanja kfc kay...

#include <stdio.h>

void main()
{
float nilai_awal=0, result=0;
int pilihan;

printf("1. Milimeter ke Centimeter.\n");
printf("2. Centimeter ke Milimeter.\n");
printf("Sila pilih operasi penukaran :");
scanf("%d",&pilihan);

        if(pilihan==1)
        {
                printf("Sila masukkan nilai awal milimeter :");
                scanf("%f",&nilai_awal);
               
                result=nilai_awal/10;
               
                printf("%.3f milimeter = %.3f centimeter",nilai_awal, result);       
        }
        else if(pilihan==2)
        {
                printf("Sila masukkan nilai awal centimeter :");
                scanf("%f",&nilai_awal);
               
                result=nilai_awal*10;
               
                printf("%.3f centimeter = %.3f milimeter",nilai_awal, result);
        }
        else
        {
                printf("Bengapla ko ni..");
        }

}
Reply

Use magic Report

 Author| Post time 30-8-2006 07:24 PM | Show all posts
hehhehe..

dah tauh dah... shahnazz dah ajor..

tq very much to all....


:lebai:
Reply

Use magic Report

Post time 30-8-2006 11:58 PM | Show all posts
:malu::malu::malu:

[ Last edited by  poyoex at 31-8-2006 12:00 AM ]
Reply

Use magic Report

Follow Us
Post time 1-9-2006 09:13 AM | Show all posts

Reply #6 poyoex's post

good code simple and nice
Reply

Use magic Report

Post time 4-9-2006 10:12 PM | Show all posts
thnx sha...

[ Last edited by  poyoex at 4-9-2006 10:15 PM ]
Reply

Use magic Report


ADVERTISEMENT


You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

22-5-2024 04:40 AM GMT+8 , Processed in 0.061080 second(s), 34 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list