I need some help with my C++ code.
When I try to compile, I get this error message:
C:\Program Files\Microsoft Visual Studio 9.0\VC>cl c\c++\teacher.cpp
Microsoft ® 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright © Microsoft Corporation. All rights reserved.
teacher.cpp c1xx : fatal error C1083: Cannot open source file: 'c\c++\teacher.cpp': No such file or directory C:\Program Files\Microsoft Visual Studio 9.0\VC>cl c:\c++\teacher.cpp Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. teacher.cpp C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C 4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc c:\c++\teacher.cpp(2) : error C2146: syntax error : missing ';' before identifie r 'std' c:\c++\teacher.cpp(2) : error C2873: 'namepace' : symbol cannot be used in a usi ng-declaration c:\c++\teacher.cpp(2) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\c++\teacher.cpp(2) : error C2365: 'std' : redefinition; previous definition w as 'namespace' c:\c++\teacher.cpp(11) : error C2065: 'cout' : undeclared identifier c:\c++\teacher.cpp(13) : error C2065: 'cin' : undeclared identifier c:\c++\teacher.cpp(15) : error C2065: 'cout' : undeclared identifier c:\c++\teacher.cpp(17) : error C2065: 'cin' : undeclared identifier c:\c++\teacher.cpp(21) : error C2065: 'cout' : undeclared identifier c:\c++\teacher.cpp(22) : error C2065: 'cout' : undeclared identifier c:\c++\teacher.cpp(24) : error C2065: 'cout' : undeclared identifier C:\Program Files\Microsoft Visual Studio 9.0\VC>
Here is my code, it's a program that is designed to find grade percentages:
#include <iostream>
using namepace std;
//This is a program that teachers can use to calculate grade percentages
//Formula (totalpoints - numbermissed) / totalpoints = grade
int main()
{
int tp,nm,fst,pc; //initializes variables
//--Start code--
cout << "Enter total points possible:/n";
system("pause");
cin >> tp;
system("pause");
cout << "Enter points missed:/n";
system("pause");
cin >> nm;
fst = tp - nm;
pc = fst / tp;
system("pause");
cout << "Grade percentage:/n";
cout << pc;
system("pause");
cout << "Press enter to close.";
return 0;
}

New Topic/Question
Reply




MultiQuote






|