I'm not only new to C++, I'm new to VS 2013 Pro. I wrote this trivial program just to see if I could get it to compile and I'm getting the following errors:
#include <iostream>
usingnamespace std;
int Main()
{
int i;
int Num = 0;
for (i = 1; i < 12; i++)
{
string tab = "\t";
int Num = i;
cout << Num;
cout << "tab";
if (Num = 3)
{
cout << endl;
}
if (Num = 6)
{
cout << endl;
}
if (Num = 12)
{
cout << endl;
}
return 0;
cout << "Press enter to stop";
cin.get();
}
}
1 2 3 4
1>c:\users\paule\documents\visual studio 2013\projects\numbergrid\numbergrid\number.cpp(36):
warning C4715: 'Main' : not all control paths return a value
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol
_main referenced in function ___tmainCRTStartup
I've tried everything I can think of and made sure my braces line up. Also all my semicolons are in order I think.
I also researched the problem on the internet and what I camme up with doesn't really seem to make a difference (ie; project-properties-linker-subsystem-Console).
If anyone is familiar with VS 2013 and can help me with this I would appreciate it.
First, logic wise, why do you have the 'return 0' statement on line 31? You will only iterate once, because you will meet the return statement in the for loop before it iterates. Moving it outside the loop will also fix your warning.
As for you error: its supposed to be intmain() rather than intMain() - C++ is a case-sensitive language.