Home » Server Options » Text & interMedia » What am I doing wrong? My currency converter is not working(Using visual c++)
What am I doing wrong? My currency converter is not working(Using visual c++) [message #75924] Tue, 12 March 2002 10:19 Go to next message
Robert
Messages: 43
Registered: August 2000
Member
#include "iostream.h"

#include "stdlib.h"

using namespace std;

int main()

;{
double rate = 0.0;
cout <<"Type in today's Exchange rate between U.S. dollar and
Japanese yen:";
cin >> rate;
if (cin.fail())
{ cout<< "Error: bad inputn";
return 1;
}//input validation

double yen =0.0;
bool more = true;
cout << "Enter U.S. Dollar values, 0 or negative number to
finish:"<<"n";
while (more)

{
double usDollar;
if (cin >> usDollar)
{
if (usDollar <= 0 ) //test for sentinel
more = false;
else
{
yen = usDollar * rate;
cout << yen <<" ";
}
}
}
return 0;
}

--------------------Configuration: Cur - Win32 Debug--------------------
Compiling...
Cur.cpp
C:WindowsDesktopCur.cpp(8) : error C2871: 'std' : does not exist or is not a namespace
C:WindowsDesktopCur.cpp(12) : error C2447: missing function header (old-style formal list?)
C:WindowsDesktopCur.cpp(14) : error C2001: newline in constant
C:WindowsDesktopCur.cpp(15) : error C2001: newline in constant
C:WindowsDesktopCur.cpp(24) : error C2001: newline in constant
C:WindowsDesktopCur.cpp(25) : error C2017: illegal escape sequence
C:WindowsDesktopCur.cpp(25) : error C2001: newline in constant
Error executing cl.exe.

Cur.obj - 7 error(s), 0 warning(s)
Re: What am I doing wrong? My currency converter is not working(Using visual c++) [message #75932 is a reply to message #75924] Thu, 21 March 2002 08:54 Go to previous messageGo to next message
abhay
Messages: 10
Registered: March 2002
Junior Member
#include "iostream.h"
#include "stdlib.h"

//using namespace std;

int main()
{
double rate = 0.0;
cout <<"Type in today's Exchange rate between U.S. dollar and Japanese yen:";
cin >> rate;
if (cin.fail())
{ cout<< "Error: bad inputn";
return 1;
}//input validation

double yen =0.0;
bool more = true;
cout << "Enter U.S. Dollar values, 0 or negative number to finish:"<<"n";
while (more)

{
double usDollar;
if (cin >> usDollar)
{
if (usDollar <= 0 ) //test for sentinel
more = false;
else
{
yen = usDollar * rate;
cout << yen <<" ";
}
}
}
return 0;
}
Re: What am I doing wrong? My currency converter is not working(Using visual c++) [message #75990 is a reply to message #75924] Sat, 28 September 2002 20:35 Go to previous message
Chris
Messages: 128
Registered: November 1998
Senior Member
How can fix error C2001: newline in constant

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

int main()

{
int a = 40;
double wage_per_hour = 6.50;
double weekly_sales;
double percent_sales = 0.1;
double percent = 0.15;
float total_pay1;
float total_pay2;
char again;
cout.setf(ios::fixed);
cout.precision(5);
do
{
cout<<"please enter the expected weekly sales n";
cin >> weekly_sales;


total_pay1 = (a * wage_per_hour)+(percent_sales * weekly_sales);
total_pay2 = (weekly_sales * percent);

cout <<"The amount of money you will receive if you take payment
<< "plan A is" << total_pay1
<<"The amount of money you will receive under payment plan B is"
<< total_pay2 << "n";

cout << "Do you want to run this program again? (y/n)";
cin >> again;
cout << endl;
}

while (again=='Y'|| again=='y');
cout<<"Goodby!n";

return 0;
}
Previous Topic: Executing CTX_DOC.MARKUP in memory from Pro*C
Next Topic: CREATE INDEX ... as ctxsys.context fails with DRG-11422, DRG-00100, DRG-11208
Goto Forum:
  


Current Time: Wed Aug 27 18:38:47 CDT 2014

Total time taken to generate the page: 0.08924 seconds