// taco_2.cpp : this one just uses basic user input to give a computer output. // #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { return 0; } // initialization of variables #include <iostream> using namespace std; int main () { int paulnum1; int paulnum2; cout << " How many you want " << endl; cin >> paulnum1; cout << " ur new number is " << endl; paulnum1 = paulnum1 + 20; cout << paulnum1 << endl; cout << " now pick another number " << endl; cin >> paulnum2; cout << " ur new number is " << endl; paulnum2 = paulnum1 + 20; cout << paulnum2 << endl; cout << " there u have ur new number on top u bitch " << endl; cin.get(); cin.get(); cin.get(); cin.get(); return 0; } |
why if i run this without the int _tmain (int argc.....) etc it wont work? |
secondly i have to put like 4 or 5 cin.get() at the end |
the error messages are horrible |
they force you to do everything Microsoft's way |
VS Compiler wrote: |
---|
1>------ Build started: Project: assignment 4 again, Configuration: Debug Win32 ------ 1> assignment 4 again.cpp 1>c:\users\abbey\documents\visual studio 2010\projects\assignment 4 again\assignment 4 again\assignment 4 again.cpp(10): error C2062: type 'int' unexpected 1>c:\users\abbey\documents\visual studio 2010\projects\assignment 4 again\assignment 4 again\assignment 4 again.cpp(12): error C2065: 'stop' : undeclared identifier 1>c:\users\abbey\documents\visual studio 2010\projects\assignment 4 again\assignment 4 again\assignment 4 again.cpp(12): fatal error C1903: unable to recover from previous error(s); stopping compilation ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
It only shows two errors, while Code Blocks showed me about 15 errors. |
And forcing you to do everything Microsoft's way was referring to the that if you don't know exactly what you're doing, like in srikev100's instance, it can greatly confuse someone. |
Code Blocks Compiler wrote: |
---|
C:\...\Test Project\main.cpp||In function 'void Read(int*, int*, int*, int*)':| C:\...\Test Project\main.cpp|10|error: expected unqualified-id before 'int'| C:\...\Test Project\main.cpp|12|error: 'stop' was not declared in this scope| C:\...\Test Project\main.cpp|29|error: 'Ai' was not declared in this scope| C:\...\Test Project\main.cpp||In function 'void print(int*, int, int, char*)':| C:\...\Test Project\main.cpp|118|error: declaration of 'int nofcorrectanswers' shadows a parameter| C:\...\Test Project\main.cpp|138|error: '::main' must return 'int'| C:\...\Test Project\main.cpp||In function 'int main()':| C:\...\Test Project\main.cpp|147|error: 'system' was not declared in this scope| ||=== Build finished: 6 errors, 0 warnings ===| |
As for the system part, it was because the system("pause"); at the end of the main, which is actually supposed to be caught. Edit: The #include<stdlib.h> was never used. |
It should search the entire program for all errors before stopping, not receiving a fatal error over a variable. |
std::cout<<x;