View previous topic :: View next topic |
Author |
Message |
aasddsaadsasdasdasdassads Expert Cheater
Reputation: 0
Joined: 28 Aug 2008 Posts: 161 Location: Singapore
|
Posted: Thu Nov 27, 2008 2:17 am Post subject: Some help needed |
|
|
Code: |
#include <iostream.h>
void calc ()
{
float num1;
float num2;
char op;
float ans;
cout << "Calculator!" << endl;
cout << "Enter two numbers and perform an operation." << endl;
cout << "Enjoy!!!!!!!!"
cout << "Enter the first number and press ENTER:" << endl;
cin >> num1;
cout << "Enter the second number and press ENTER:" << endl
cin >> num2;
cout << "You entered " << num1 << "and" << num2 << endl;
cout
<< "Press A followed by ENTER to subtract the two numbers."
<< endl
<< "Press S followed by ENTER to multiply the two numbers."
<< endl
<< "Press M followed by ENTER to multiply the two numbers."
<< endl
<< "Press D followed by ENTER to multiply the two numbers."
<< endl;
cout << "---------------------------" << endl;
cin >> op;
if (op == 65)
{
ans = num1 + num2 ;
}
if (op == 83)
{
ans = num1 - num2;
}
(if op == 77)
{
ans = num1 * num2;
}
if (op == 68)
{
ans = num1 / num2;
}
cout << " The answer is " << and << endl;
cout << "Thanks for using the Calculator." << endl;
cout << "Application now exiting ..." << endl;
}
|
I'm a 12 year old that trying to learn programming and i need some help. The error read:
Code: 800A0400
Source: Microsoft VBscript compilation error.
err i saved this as a .vbs using Ultraedit and its supposed to be a calculator or smth( learning from a manual ). Please Help! WIll +rep if helped!
Description: |
|
Filesize: |
15.54 KB |
Viewed: |
4342 Time(s) |

|
|
|
Back to top |
|
 |
Frostbyt3 Master Cheater
Reputation: 0
Joined: 07 Jan 2008 Posts: 323 Location: Australia
|
Posted: Thu Nov 27, 2008 2:20 am Post subject: |
|
|
The problem is that it is not a VBScript.
What you need is a C++ IDE.You should try Visual C++ 2008 Express.
|
|
Back to top |
|
 |
aasddsaadsasdasdasdassads Expert Cheater
Reputation: 0
Joined: 28 Aug 2008 Posts: 161 Location: Singapore
|
Posted: Thu Nov 27, 2008 2:21 am Post subject: huh |
|
|
huh pls explain what i really need to do.
|
|
Back to top |
|
 |
Frostbyt3 Master Cheater
Reputation: 0
Joined: 07 Jan 2008 Posts: 323 Location: Australia
|
Posted: Thu Nov 27, 2008 3:20 am Post subject: |
|
|
If you didn't get that, gee, I'm worried.
Download Visual C++ 2008
Install
New Project, Console Application
Delete all the code and paste that in. If that doesn't work, that code is dodgy. Which it is, cause I see why it is.
I'll give you a hint though. Calc wont be called(run) but main will.]
|
|
Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Thu Nov 27, 2008 3:24 am Post subject: |
|
|
Frostbyt3 wrote: | I'll give you a hint though. Calc wont be called(run) but main will.] | /ENTRY:"calc" :)
|
|
Back to top |
|
 |
aasddsaadsasdasdasdassads Expert Cheater
Reputation: 0
Joined: 28 Aug 2008 Posts: 161 Location: Singapore
|
Posted: Thu Nov 27, 2008 8:23 am Post subject: Downloaded |
|
|
I installed and dled, then?? I also changed calc to main
|
|
Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Thu Nov 27, 2008 8:37 am Post subject: Re: Downloaded |
|
|
raprap30 wrote: | I installed and dled, then?? I also changed calc to main |
Start a new project, write your code, compile and run.
|
|
Back to top |
|
 |
aasddsaadsasdasdasdassads Expert Cheater
Reputation: 0
Joined: 28 Aug 2008 Posts: 161 Location: Singapore
|
Posted: Thu Nov 27, 2008 8:49 am Post subject: which kind of project |
|
|
which kind of project?? btw i rename the thing to exe and they said that the ntvdm cpu has encountered an illegal instruction.
|
|
Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Thu Nov 27, 2008 8:57 am Post subject: |
|
|
Win32 Console.
|
|
Back to top |
|
 |
killersamurai Expert Cheater
Reputation: 0
Joined: 10 Sep 2007 Posts: 197 Location: Colorado
|
Posted: Fri Nov 28, 2008 12:01 am Post subject: |
|
|
There are a few mistakes in the code.
Errors:
*Missing a few semi-colons
*#include <iostream>
not
#include <iostream.h>
*and to ans
*not using int main(). You could set the entry to that function, but that isn't part of the c++ standard
*the compiler will not know where cout, cin, or endl is coming or what it is. You would need to append std::. Else, you can either do
Code: |
using std::cout;
using std::cin;
using std::endl;
|
or
Code: |
using namespace std;
|
I do not recommend you do it this way. It's a bad programming habit. There's more to it, but since you are beginning, we'll leave it at that.
As for an IDE, get Visual Studio. There is a free edition of it.
http://www.microsoft.com/express/vc/Default.aspx
It has one of the best compilers and the debugger is top of the line (if you know how to use it).
I am sometimes required to tutor kids your age and from experience, I notice that age group tend to learn better by seeing it. So, I've made a little video to demonstrate how to create a project, add a source file, fix the errors, and how to run the program. I'm using the professional edition, so if you're using the express, you'll notice a difference in the layout. The file is a little too big (11.2mb) for an attachment, so I upped it to rapidshare. Encoded using xvid, so you will need that to watch it.
Code: |
http://rapidshare.com/files/168123399/starting_project.rar
|
|
|
Back to top |
|
 |
|