Solved

VC++.net hello world

Posted on 2007-04-09
11
196 Views
Last Modified: 2013-12-14
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
Comment
Question by:jaxrpc
  • 6
  • 5
11 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 18877329
       #include <stdio>

should be :

        #include <cstdio>

Also, add this header :

        #include <cstdlib>

and use :

        system("PAUSE");

instead of :

        pause();
0
 

Author Comment

by:jaxrpc
ID: 18877343
hi infinity08,

but why is it that in some book examples it is stated as #include <stdio>
0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 500 total points
ID: 18877361
I don't know about .NET, but in C++, there's no such header. It's either :

       #include <stdio.h>

or :

       #include <cstdio>
0
 

Author Comment

by:jaxrpc
ID: 18877372
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
 
LVL 53

Expert Comment

by:Infinity08
ID: 18877380
>> 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 53

Expert Comment

by:Infinity08
ID: 18877397
btw, can you show the whole code ? Where did you implement the adding function ?
0
 

Author Comment

by:jaxrpc
ID: 18877402
hi, i implemeneted the add function below the main. i guess my problem is with the header file. thanks
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 18877416
>> 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
 

Author Comment

by:jaxrpc
ID: 18877426
int adding(int a, int n)
{
      int answer = 0;
      answer = a + n;

      return answer;
}

thanks
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 18877434
Ok ... looks fine ... Does the code compile and run without problems now ?
0
 

Author Comment

by:jaxrpc
ID: 18877443
yup it does now. Really appreciated your help. thanks
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now