I'm a new to C++ in VB. I was wondering if anyone knows why i keep getting errors in VB when creating a new line using \n.
I keep getting the following error
1>------ Build started: Project: CjohnsonAS1, Configuration: Debug Win32 ------
1>Compiling...
1>cjohnsonAS1.cpp
1>c:\users\christian\documents\visual studio 2005\projects\cjohnsonas1\cjohnsonas1\cjohnsonas1. cpp(23) : error C2017: illegal escape sequence
1>c:\users\christian\documents\visual studio 2005\projects\cjohnsonas1\cjohnsonas1\cjohnsonas1. cpp(23) : error C2146: syntax error : missing ';' before identifier 'n'
1>c:\users\christian\documents\visual studio 2005\projects\cjohnsonas1\cjohnsonas1\cjohnsonas1. cpp(23) : error C2065: 'n' : undeclared identifier
1>c:\users\christian\documents\visual studio 2005\projects\cjohnsonas1\cjohnsonas1\cjohnsonas1. cpp(26) : error C2017: illegal escape sequence
1>c:\users\christian\documents\visual studio 2005\projects\cjohnsonas1\cjohnsonas1\cjohnsonas1. cpp(26) : error C2146: syntax error : missing ';' before identifier 'n'
1>c:\users\christian\documents\visual studio 2005\projects\cjohnsonas1\cjohnsonas1\cjohnsonas1. cpp(29) : error C2017: illegal escape sequence
1>c:\users\christian\documents\visual studio 2005\projects\cjohnsonas1\cjohnsonas1\cjohnsonas1. cpp(29) : error C2146: syntax error : missing ';' before identifier 'n'
1>Build log was saved at "file://c:\Users\christian\Documents\Visual Studio 2005\Projects\CjohnsonAS1\CjohnsonAS1\Debug\BuildL og.htm"
1>CjohnsonAS1 - 7 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The actual script i created is as followed
insertcould anyone explain to my why i can not compile this program and why it keeps saying /n is whats causing the error . or is that even what the Error message is saying. Any tips btw would be greatly appreciated. as i mentioned before I am new to programming...Code:#include <iostream> #include <iomanip> using namespace std; int main() { double salary_yr = 0, yearly_rate = 0, intrest_calc = 0, intrest_calc2 = 0, intrest_calc3 = 0, total_yr1 = 0, total_yr2 = 0, total_yr3 = 0; const double converson = 0.06; cout << "enter your current anual pay: "; cin >> salary_yr; cout << "enter percentage of anual salary increse: "; cin >> yearly_rate; intrest_calc = salary_yr * converson; total_yr1 = intrest_calc + salary_yr; cout << " annual salary intrest for year one "<<total_yr1 \n; intrest_calc2 = total_yr1 * converson ;total_yr2 = total_yr1 + intrest_calc2; cout << " annual salay increase of second year is "<<total_yr2 \n; intrest_calc3 = total_yr2 * converson; total_yr3 = total_yr2 + intrest_calc3; cout << " annual salary increase of second year is "<<total_yr3 \n; return 0; }
thanks
cj



LinkBack URL
About LinkBacks



