Solved

VC++.net hello world

Posted on 2007-04-09
11
209 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

856 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