Solved

VC++.net hello world

Posted on 2007-04-09
11
204 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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
 
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
convert char array to number in c 5 85
Unable to open debugger port in Intellij idea 6 227
C++ question 3 65
Why  my code (program) build with old compiler? 11 47
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

803 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