473,769 Members | 6,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error C2660: 'System::Math:: Pow' : function does not take 1 arguments

2 New Member
Hello All,

I am taking a class using Visual Studio C++ Express 2010 and on one of the first projects i need to use the Math::Pow() function. The book does not do a good job of explaining how to use this. I was able to create the program and calculate simple interest fine with a normal formula however once I needed to calculate compounded interest it required a exponent.

Line 203 of the Code is where the error is.

"error C2660: 'System::Math:: Pow' : function does not take 1 arguments"

I hope this clarifies my issue.
Thanks in advance,
Richard



Formulas used:
Simple Interest = Principal * (1 + (Years * Rate))
Compound Interest = Principal * (1 + Rate)^Years

This is the Line of code that is giving me this error:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  // Process data
  3.              sum = (num1 * (Math::Pow(1 + (num2*.01)),num3));
  4.  
Here is all of the program.

Expand|Select|Wrap|Line Numbers
  1. #pragma once
  2.  
  3. namespace InterestCalculator {
  4.  
  5.     using namespace System;
  6.     using namespace System::ComponentModel;
  7.     using namespace System::Collections;
  8.     using namespace System::Windows::Forms;
  9.     using namespace System::Data;
  10.     using namespace System::Drawing;
  11.  
  12.     /// <summary>
  13.     /// Summary for Form1
  14.     /// </summary>
  15.     public ref class Form1 : public System::Windows::Forms::Form
  16.     {
  17.     public:
  18.         Form1(void)
  19.         {
  20.             InitializeComponent();
  21.             //
  22.             //TODO: Add the constructor code here
  23.             //
  24.         }
  25.  
  26.     protected:
  27.         /// <summary>
  28.         /// Clean up any resources being used.
  29.         /// </summary>
  30.         ~Form1()
  31.         {
  32.             if (components)
  33.             {
  34.                 delete components;
  35.             }
  36.         }
  37.     private: System::Windows::Forms::TextBox^  textBoxPrincipal;
  38.     protected: 
  39.     private: System::Windows::Forms::TextBox^  textBoxRate;
  40.     private: System::Windows::Forms::TextBox^  textBoxYears;
  41.     private: System::Windows::Forms::TextBox^  textBoxSimple;
  42.     private: System::Windows::Forms::TextBox^  textBoxCompound;
  43.     private: System::Windows::Forms::Button^  button1;
  44.     private: System::Windows::Forms::Button^  button2;
  45.     private: System::Windows::Forms::Label^  label1;
  46.     private: System::Windows::Forms::Label^  label2;
  47.     private: System::Windows::Forms::Label^  label3;
  48.  
  49.     private:
  50.         /// <summary>
  51.         /// Required designer variable.
  52.         /// </summary>
  53.         System::ComponentModel::Container ^components;
  54.  
  55. #pragma region Windows Form Designer generated code
  56.         /// <summary>
  57.         /// Required method for Designer support - do not modify
  58.         /// the contents of this method with the code editor.
  59.         /// </summary>
  60.         void InitializeComponent(void)
  61.         {
  62.             this->textBoxPrincipal = (gcnew System::Windows::Forms::TextBox());
  63.             this->textBoxRate = (gcnew System::Windows::Forms::TextBox());
  64.             this->textBoxYears = (gcnew System::Windows::Forms::TextBox());
  65.             this->textBoxSimple = (gcnew System::Windows::Forms::TextBox());
  66.             this->textBoxCompound = (gcnew System::Windows::Forms::TextBox());
  67.             this->button1 = (gcnew System::Windows::Forms::Button());
  68.             this->button2 = (gcnew System::Windows::Forms::Button());
  69.             this->label1 = (gcnew System::Windows::Forms::Label());
  70.             this->label2 = (gcnew System::Windows::Forms::Label());
  71.             this->label3 = (gcnew System::Windows::Forms::Label());
  72.             this->SuspendLayout();
  73.             // 
  74.             // textBoxPrincipal
  75.             // 
  76.             this->textBoxPrincipal->Location = System::Drawing::Point(12, 25);
  77.             this->textBoxPrincipal->Name = L"textBoxPrincipal";
  78.             this->textBoxPrincipal->Size = System::Drawing::Size(100, 20);
  79.             this->textBoxPrincipal->TabIndex = 0;
  80.             // 
  81.             // textBoxRate
  82.             // 
  83.             this->textBoxRate->Location = System::Drawing::Point(118, 25);
  84.             this->textBoxRate->Name = L"textBoxRate";
  85.             this->textBoxRate->Size = System::Drawing::Size(100, 20);
  86.             this->textBoxRate->TabIndex = 1;
  87.             // 
  88.             // textBoxYears
  89.             // 
  90.             this->textBoxYears->Location = System::Drawing::Point(224, 25);
  91.             this->textBoxYears->Name = L"textBoxYears";
  92.             this->textBoxYears->Size = System::Drawing::Size(100, 20);
  93.             this->textBoxYears->TabIndex = 2;
  94.             // 
  95.             // textBoxSimple
  96.             // 
  97.             this->textBoxSimple->Location = System::Drawing::Point(158, 51);
  98.             this->textBoxSimple->Name = L"textBoxSimple";
  99.             this->textBoxSimple->Size = System::Drawing::Size(166, 20);
  100.             this->textBoxSimple->TabIndex = 3;
  101.             // 
  102.             // textBoxCompound
  103.             // 
  104.             this->textBoxCompound->Location = System::Drawing::Point(158, 77);
  105.             this->textBoxCompound->Name = L"textBoxCompound";
  106.             this->textBoxCompound->Size = System::Drawing::Size(166, 20);
  107.             this->textBoxCompound->TabIndex = 4;
  108.             // 
  109.             // button1
  110.             // 
  111.             this->button1->Location = System::Drawing::Point(37, 49);
  112.             this->button1->Name = L"button1";
  113.             this->button1->Size = System::Drawing::Size(115, 23);
  114.             this->button1->TabIndex = 5;
  115.             this->button1->Text = L"Simple Interest";
  116.             this->button1->UseVisualStyleBackColor = true;
  117.             this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
  118.             // 
  119.             // button2
  120.             // 
  121.             this->button2->Location = System::Drawing::Point(37, 78);
  122.             this->button2->Name = L"button2";
  123.             this->button2->Size = System::Drawing::Size(115, 23);
  124.             this->button2->TabIndex = 6;
  125.             this->button2->Text = L"Compound Interest";
  126.             this->button2->UseVisualStyleBackColor = true;
  127.             this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
  128.             // 
  129.             // label1
  130.             // 
  131.             this->label1->AutoSize = true;
  132.             this->label1->Location = System::Drawing::Point(12, 9);
  133.             this->label1->Name = L"label1";
  134.             this->label1->Size = System::Drawing::Size(47, 13);
  135.             this->label1->TabIndex = 7;
  136.             this->label1->Text = L"Principal";
  137.             // 
  138.             // label2
  139.             // 
  140.             this->label2->AutoSize = true;
  141.             this->label2->Location = System::Drawing::Point(119, 9);
  142.             this->label2->Name = L"label2";
  143.             this->label2->Size = System::Drawing::Size(30, 13);
  144.             this->label2->TabIndex = 8;
  145.             this->label2->Text = L"Rate";
  146.             // 
  147.             // label3
  148.             // 
  149.             this->label3->AutoSize = true;
  150.             this->label3->Location = System::Drawing::Point(223, 9);
  151.             this->label3->Name = L"label3";
  152.             this->label3->Size = System::Drawing::Size(34, 13);
  153.             this->label3->TabIndex = 9;
  154.             this->label3->Text = L"Years";
  155.             // 
  156.             // Form1
  157.             // 
  158.             this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  159.             this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  160.             this->ClientSize = System::Drawing::Size(341, 115);
  161.             this->Controls->Add(this->label3);
  162.             this->Controls->Add(this->label2);
  163.             this->Controls->Add(this->label1);
  164.             this->Controls->Add(this->button2);
  165.             this->Controls->Add(this->button1);
  166.             this->Controls->Add(this->textBoxCompound);
  167.             this->Controls->Add(this->textBoxSimple);
  168.             this->Controls->Add(this->textBoxYears);
  169.             this->Controls->Add(this->textBoxRate);
  170.             this->Controls->Add(this->textBoxPrincipal);
  171.             this->Name = L"Form1";
  172.             this->Text = L"Form1";
  173.             this->ResumeLayout(false);
  174.             this->PerformLayout();
  175.  
  176.         }
  177. #pragma endregion
  178.     private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
  179.                  // Declare variables num1 Principal, num2 Rate, num3 Years,
  180.              double num1, num2, num3, sum;
  181.  
  182.              // Read in Data
  183.              Double::TryParse(textBoxPrincipal->Text, num1);
  184.              Double::TryParse(textBoxRate->Text, num2);
  185.              Double::TryParse(textBoxYears->Text, num3);
  186.  
  187.              // Process data
  188.              sum = num1 * (1 + (num3 * (num2*.01)));
  189.  
  190.              // Display results
  191.              textBoxSimple->Text = sum.ToString();
  192.              }
  193. private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
  194.              // Declare variables num1 Principal, num2 Rate, num3 Years,
  195.              double num1, num2, num3, sum;
  196.  
  197.              // Read in Data
  198.              Double::TryParse(textBoxPrincipal->Text, num1);
  199.              Double::TryParse(textBoxRate->Text, num2);
  200.              Double::TryParse(textBoxYears->Text, num3);
  201.  
  202.              // Process data
  203.              sum = (num1 * (Math::Pow(1 + (num2*.01)),num3));
  204.  
  205.              // Display results
  206.              textBoxCompound->Text = sum.ToString();
  207.  
  208.          }
  209. };
  210. }
  211.  
  212.  
Attached Files
File Type: txt Interest Calculator.txt (6.9 KB, 557 views)
Jan 18 '11 #1
2 4333
tdlr
22 New Member
Expand|Select|Wrap|Line Numbers
  1. sum = (num1 * (Math::Pow(1 + (num2*.01),num3)));
fix'd. (there was one closing bracket misplaced)
Jan 18 '11 #2
Richard Ballin
2 New Member
Thank you so much... I have no idea how many times I went over this looking for little mistakes like that. Even with the IDE matching brackets I still did not find that.

This has solved my issue.

Thank you again.
Richard
Jan 18 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2866
by: Magix | last post by:
#include <math.h> double pow( double base, double exp ); will pow (2, -30) works fine ? (exp is negative value). If not, what are the workaround for exp to be negative?
5
2254
by: Ark | last post by:
Hi everyone, Does anyone know if Direct3D overloads System.Math functions? Also is it possible to access the base functions of the overloaded function (in other words restore original of the overlaoded function)? Thank you
0
1387
by: BuddyWork | last post by:
Hello, Here is an update. There is no differences with the function System.Math.Log10 under any operating system. The problem is with the casting of the datatype double and value Infinite to datatype int.
3
17949
by: pontifikas | last post by:
I'm pretty damn sure there should be a System.Math library somewhere around .Net. But I cannot find it. What is the name of the reference for it? Any Ideas? What could I be doing wrong? *-----------------------* Posted at:
8
6849
by: fl1p-fl0p | last post by:
import math math.pow(34564323, 456356) will give math range error. how can i force python to process huge integers without math range error? Any modules i can use possibly?
2
3315
by: matrim | last post by:
What I'm trying to do: 1. Attempt to open the file. The filename, c:\\windData.txt, should be hardcoded into your program. Note the two slash characters in the file name. If the file cannot be opened, display a message and exit the program. 2. From the file read a temperature and a wind speed. Both values should be stored in variables declared as double. The file is a text file. 3. Calculate the wind chill factor using a programmer...
4
10652
by: astri | last post by:
#include "Unit1.h" #include "math.h" #include "fixed_math.hpp" #include "algorithm.h" #define MBIT 0x4000 #define CBIT 16 long constbl; void __fastcall TForm1::Button1Click(TObject *Sender)
1
3104
by: merarajesh | last post by:
hi, I am developing intensity of wave in physics. I am using system.math in c#. every thing is fine. but the result of Intensity is not well. my formula is:- I=4*a2*cos2(delta/2); delta=2pi/lambda*trangle; trangle=dx/d lambda=constant*10pow-10;
5
4390
by: Tzury Bar Yochay | last post by:
What is the reason math.pow yields OverflowError while python itself can calculate these large numbers. e.g: 1e+308 Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: math range error 10000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000
1
2395
by: bvav22 | last post by:
I am trying to write a program that will calculate monthly payments based on information entered by the user. however, when i used math.pow it returns infinity. i know my formula is right i have tested it with a calculator 100 times now, i just dont get why its returning infinity. this is my code... import java.util.Scanner; public class problem2 { public static void main(Stringargs) {
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10048
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.