i m new to console apps and would appreciate some pointers...
i have created a new console app and (not finished but it should be working), i selected win32 console app and then selected empty project
here s my code:
#include <iostream>
void main() {
struct dude {
string name;
int age;
} about;
about.name = "jason";
about.age = 4000;
cout << about.name << " " << about.age << endl;
}
The following errors i get are:
------ Build started: Project: Test, Configuration: Debug Win32 ------
Compiling...
codey.cpp
.codey.cpp(6) : error C2146: syntax error : missing ; before identifier name
.codey.cpp(6) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.codey.cpp(6) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.codey.cpp(10) : error C2039: name : is not a member of main::dude
.codey.cpp(5) : see declaration of main::dude
.codey.cpp(12) : error C2065: cout : undeclared identifier
.codey.cpp(12) : error C2039: name : is not a member of main::dude
.codey.cpp(5) : see declaration of main::dude
.codey.cpp(12) : error C2065: endl : undeclared identifier
Build log was saved at "file://c:UsersJasonDocumentsVisual Studio 2008ProjectsTestTestDebugBuildLog.htm"
Test - 7 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
can somebody please tell me how i can get this to debug? what have i done wrong here?
Working...
#include <iostream>
#include <string>
struct Dude {
std::string name;
int age; };
int main(int i)
{
while(i<4000)
{
i++;
using namespace std;
Dude jason = { "Jason", i };
cout << jason.name << " is " << jason.age << " years old.
";
}
return 0;
}
thank you all for your help :D