Cpp - Output Exchange rate between Euro and Dollar

Description

Output Exchange rate between Euro and Dollar

Demo

#include <iostream> 
#include <iomanip> 
using namespace std; 

int main() //  w ww  .  ja va2  s. c  om
{ 
    double rate = 1.15;   // Exchange rate: 
                               // one Euro to one Dollar 
    cout << fixed << setprecision(2); 

    cout << "\tEuro \tDollar\n"; 

    for( int euro = 1; euro <= 5; ++euro) 
      cout << "\t " << euro << "\t " << euro*rate << endl; 

    return 0; 
}

Result

You can define the loop counter in expression1.

Doing so means that the counter can be used within the loop, but not after leaving the loop.

for( int i = 0; i < 10; cout << i++ ) 
    ; 

The loop body can be an empty statement.

Related Example