Page 1 of 1

curcon - currency converter

Posted: Fri Jan 29, 2016 7:07 pm
by machinebacon
Again nothing fancy, but you can change it to fit your needs. As it is now, it converts CUR1 (cur1) to CUR2 (cur2) at an exchange rate of 0.140 (exc)

Code: Select all

#include<stdio.h>
#include<stdlib.h>
#include<err.h>

float cur1,cur2,exc;

int main (int argc, char *argv[]) {

  if (argc != 2) {
    fprintf(stderr, "Usage: Enter amount in CUR1\n");
    exit(1);
  }

  exc = 0.140;
  cur1 = atof(argv[1]);
  cur2 = cur1 * exc;
  printf("%.2f CUR1 is %.2f CUR2\n", cur1, cur2);

return 0;

}

Re: curcon - currency converter

Posted: Fri Jan 29, 2016 10:09 pm
by Theo
It makes me a bit sad, those old and good times...
Back in the day I changed my beloved Dutch 'gulden' to the German 'mark', it was part of the trip to Germany.
Strong and stable currency, and loved them both. I guess I'll never get used to the fucking worthless euro.

Re: curcon - currency converter

Posted: Fri Jan 29, 2016 10:20 pm
by simgin
^ Lol, I know what you mean, but...travel to Britain or Scandinavia and the memories will come back (we still have their own currency) :)
I will meet you there.

Cheerio

Simon

Re: curcon - currency converter

Posted: Sat Jan 30, 2016 1:54 pm
by machinebacon
you can

#include<goodoldtimes.h>

if you want.

/closed