Home Forums C Programming Basic C Help — Currency Converter Re: Re: Basic C Help — Currency Converter

#3451
GWILouisaxwzkla
Participant

could do something like this ( I’m not real good with stdio.h , In school I used iostream.h ) :



/*
Takes currency input from user and outputs currency conversions for USD, GBP, CAD,
EUR, AUD, CYN (Chinese Yuan)
*/

#include 
#include 

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("|

|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; }