So, I'm doing a basic USD to Euro converter for my class, and its all easy-peasy so I'm adding a little bit of flair. How do I put the Euro symbol in for a console app?
How would i put that in the code to make it turn "20.00" into "$20.00" (except using the euro symbol)? I've never worked with unicode or ISO codes or whatever... here is what I have
/*
USDToEuroConversion.cpp : main project file.
Prgmd by: me mah fuh
10/28/09
*/
#include "stdafx.h"
#include <iostream>
usingnamespace System;
int main(array<System::String ^> ^args)
{
double USD = 0;
double Euros = 0;
constdouble Rate = .8676;
std::cout<<"Welcome to Suck It bank of the Swiss - How may I help you?\n";
std::cout<<"-----------------------------\n";
std::cout<<"How many $'s do you have?\n";
std::cout<<"$";
std::cin>> USD;
std::cout<<"-----------------------------\n";
Euros = USD * Rate; //conversion
std::cout<<"you have " << Euros << " Euros.\n";
system("pause");
return 0;
}
BTW, if you want good marks, I would avoid all the bitty-kiddie talk and I would come up with a better bank name than "Suck It".
Also, "EUR 20.00" really is your best choice. Trying to do it any other way is surprisingly complex and perplexing, even to veteran programmers who have to deal with the nonsense necessary to make it happen.
If you know for sure your professor will be using Windows, you can play with the Console Code Page.
If you know for sure your professor will be using Linux, you could output the UTF-8 code sequence and it will most likely work (but that is not guaranteed). IIRC: cout << "\xE2\x82\xAC";, translated in my head just now.