Home › Forums › C Programming › Basic C Help — Currency Converter › Re: Re: Basic C Help — Currency Converter
June 1, 2009 at 10:14 pm
#3451
GWILouisaxwzkla
Participant
could do something like this ( I’m not real good with stdio.h , In school I used iostream.h ) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | /* Takes currency input from user and outputs currency conversions for USD, GBP, CAD, EUR, AUD, CYN (Chinese Yuan) */ #include <stdio.h> #include <stdlib.h> main() { /* Declare and Initialize Variables */ const float USD = 1.0000; const float GBP = 0.5653; const float CAD = 1.0637; const float EUR = 0.7006; const float AUD = 1.2335; const float CYN = 6.8400; const float UserInput = ''; /* Begin user interaction */ //could use printf ( "%20,-c" , '-' ); for this ( vc++ dosen't seem to like printf options ) printf("| <hr class="bbcode_rule" /> |n"); printf("%10s", "|" ); printf( "%8s" , "USD" ); printf( " | " ); printf( "%8s" , "GRP" ); printf( " | " ); printf( "%8s" , "CAD" ); printf( " | " ); printf( "%8s" , "EUR" ); printf( " | " ); printf( "%8s" , "AUD" ); printf( " | " ); printf( "%10s" , "CYN |n" ); printf( "%10s" , "DOL |" ); printf( "%8.2f" , CYN ); //using CYN as every value for example printf( " | " ); printf( "%8.2f" , CYN ); printf( " | " ); printf( "%8.2f" , CYN ); printf( " | " ); printf( "%8.2f" , CYN ); printf( " | " ); printf( "%8.2f" , CYN ); printf( " | " ); printf( "%8.2f" , CYN ); printf( "|n" ); return 0; } |