[Help] Code Issue

Posts 113 of 13 · Page 1 of 1
[Help] Code Issue
alright so i put this code into microsoft vb 2010 and im not sure if this is a user error or microsoft being stupid:
#include <stdio.h>
#include <iostream>

using namespace std;

int main()
{
int i;
for (i=0, i<10; i+1; );
{
cout << "Hello World!";
}
system ("pause");
}
when i run it it does nothing but sit there and blink when i run it. Help please?
Try coding in MSVC++ Not in the vB compiler.
Thats some pretty pro vb code you got there
Quote Originally Posted by awsomeownage View Post
aim not sure if this is a user error or microsoft being stupid:
Yeh its prbly Microsoft being stupid again... those idiots gave u the wrong compiler.
That code won't even work.. even on MSVC++

I just looked over the code and i see like 3 errors already. lmao :\
Code:
for (i=0, i<10; i+1; );
first of all delete that ";"
main thread does not return anything,
Code:
#include <stdio.h>
Well, someone please correct me if I'm wrong, but why include this? I mean including "iostream" is sufficient.
And try to delete that loop.....ah and Visual Basic isn't C++, normally your code shouldn't be compiled idk how can you compile it :/

So the code should be:
Code:
#include <iostream>

int main(void)
{
      std::cout << "Hello World!" << endl; //or "/n" after "Hello World!"
      system("PAUSE");
      return 0;
}
Quote Originally Posted by user590177 View Post
Code:
for (i=0, i<10; i+1; );
first of all delete that ";"
main thread does not return anything,
Code:
#include <stdio.h>
Well, someone please correct me if I'm wrong, but why include this? I mean including "iostream" is sufficient.
And try to delete that loop.....ah and Visual Basic isn't C++, normally your code shouldn't be compiled idk how can you compile it :/

So the code should be:
Code:
#include <iostream>

int main(void)
{
      std::cout << "Hello World!" << endl; //or "/n" after "Hello World!"
      system("PAUSE");
      return 0;
}

With:
Stdio.h

Code:
#include <stdio.h>

int main(void)
{
      printf("Hello World.\n");
      system("PAUSE");
      return 0;
}
Problems on that For are more then 1:

Code:
for (i=0, i<10; i+1; );
This would be correct:

Code:
for(i = 0; i < 10; i++)
Quote Originally Posted by user590177 View Post
And try to delete that loop.....ah and Visual Basic isn't C++, normally your code shouldn't be compiled idk how can you compile it :/
Why delete the loop its obviously for learn purposes..
but i dont get the point printing it to the screen 10 times
lol thanks to everyone. And i realize my typo lol. I meant C++ not VB, lol. anyone know a good book to help me learn C++?
Quote Originally Posted by awsomeownage View Post
lol thanks to everyone. And i realize my typo lol. I meant C++ not VB, lol. anyone know a good book to help me learn C++?
Try out tuts section, loaded with tutorials and guides, also cave the C++ section, you will be surprised with what that section can accidentally teach you.
Quote Originally Posted by awsomeownage View Post
anyone know a good book to help me learn C++?
Any book... besides C++ for Dummies.
Quote Originally Posted by 'Bruno View Post
That code won't even work.. even on MSVC++

I just looked over the code and i see like 3 errors already. lmao :\
Quote Originally Posted by Jason View Post
I recommend
Code:
The differences between Visual Basic and C++, By Thomas Medes
Quote Originally Posted by why06 View Post


Any book... besides C++ for Dummies.
You three made my day

Cookie?

I recommend
Code:
The differences between Visual Basic and C++, By Thomas Medes
Posts 113 of 13 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Need help?