• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

VC++.net hello world

Hi, i am having some problems with using visual C++.net express edition or is it i am not coding correctly.
I tried to use the pause(); in stdio.h but it gave me an error. and i tried to compile a simple code with a simple function. It didn't work too , it gave me an error...unable to resolve int____ add(y@@@y@@@)

Here's my code

#include <stdio>
#include <iostream>

using namespace std;

int adding(int a,int n);
int main()
{
      int answer = 0;

      int a = 10;
      int b = 10;

      answer = adding(a,b);
      cout << answer;
      pause();
      return 0;
}
0
jaxrpc
Asked:
jaxrpc
  • 6
  • 5
1 Solution
 
Infinity08Commented:
       #include <stdio>

should be :

        #include <cstdio>

Also, add this header :

        #include <cstdlib>

and use :

        system("PAUSE");

instead of :

        pause();
0
 
jaxrpcAuthor Commented:
hi infinity08,

but why is it that in some book examples it is stated as #include <stdio>
0
 
Infinity08Commented:
I don't know about .NET, but in C++, there's no such header. It's either :

       #include <stdio.h>

or :

       #include <cstdio>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
jaxrpcAuthor Commented:
hi , what i meant was #include <stdio.h> because i read that if using ansi C++ there's no need to add the .h. am i right about it?
0
 
Infinity08Commented:
>> because i read that if using ansi C++ there's no need to add the .h. am i right about it?

See my last post ...
0
 
Infinity08Commented:
btw, can you show the whole code ? Where did you implement the adding function ?
0
 
jaxrpcAuthor Commented:
hi, i implemeneted the add function below the main. i guess my problem is with the header file. thanks
0
 
Infinity08Commented:
>> hi, i implemeneted the add function below the main.

Can you show it anyway ? I want to check out the "unresolved symbol" error you got ...
0
 
jaxrpcAuthor Commented:
int adding(int a, int n)
{
      int answer = 0;
      answer = a + n;

      return answer;
}

thanks
0
 
Infinity08Commented:
Ok ... looks fine ... Does the code compile and run without problems now ?
0
 
jaxrpcAuthor Commented:
yup it does now. Really appreciated your help. thanks
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now