AIM:
To write a Visual C++ Program for the Implementation of ActiveX Template Library(ATL) in CS1255 - Visual Programming Lab.
SOURCE CODE:
To write a Visual C++ Program for the Implementation of ActiveX Template Library(ATL) in CS1255 - Visual Programming Lab.
SOURCE CODE:
Visual Basic:Dim w As LongDim x As LongDim y As LongDim z As LongDim math As String
Private Sub Command1_Click()Dim c As Longc = Val(Text1.Text)Text1.Text = c * 10 + 7
Private Sub Command10_Click()Dim c As LongText1.Text = " "End Sub
Private Sub Command11_Click()Dim c As Longc = Val(Text1.Text)Text1.Text = c * 10 + 0End Sub
Private Sub Command12_Click()If Text1.Text = " " Then Exit Suby = Val(Text1.Text)Select Case mathCase "+"Dim r As New CALCULATORLib.sampleSet r = New sampler.Add x, y, zText1.Text = zCase "-"Set r = New sampler.Sub x, y, zText1.Text = zCase "*"Set r = New sampler.prod x, y, zText1.Text = zCase "/"Set r = New sampler.div x, y, zText1.Text = zEnd SelectEnd Sub
Private Sub Command13_Click()w = 0Dim r As New CALCULATORLib.sampleSet r = New sampler.Add Text1.Text, w, xText1.Text = 0math = "+"End Sub
Private Sub Command14_Click()w = 0Dim r As New CALCULATORLib.sampleSet r = New sampler.Sub Text1.Text, w, xText1.Text = 0math = "-"End Sub
Private Sub Command15_Click()w = 1Dim r As New CALCULATORLib.sampleSet r = New sampler.prod Text1.Text, w, xText1.Text = 0math = "*"End Sub
Private Sub Command16_Click()w = 1Dim r As New CALCULATORLib.sampleSet r = New sampler.div Text1.Text, w, xText1.Text = 0math = "/"End Sub
Private Sub Command2_Click()Dim c As Longc = Val(Text1.Text)Text1.Text = c * 10 + 8End Sub
Private Sub Command3_Click()Dim c As Longc = Val(Text1.Text)Text1.Text = c * 10 + 9End Sub
Private Sub Command4_Click()Dim c As Longc = Val(Text1.Text)Text1.Text = c * 10 + 4End Sub
Private Sub Command5_Click()Dim c As Longc = Val(Text1.Text)Text1.Text = c * 10 + 5End Sub
Private Sub Command6_Click()Dim c As Longc = Val(Text1.Text)Text1.Text = c * 10 + 6End Sub
Private Sub Command7_Click()Dim c As Longc = Val(Text1.Text)Text1.Text = c * 10 + 1End Sub
Private Sub Command8_Click()Dim c As Longc = Val(Text1.Text)Text1.Text = c * 10 + 2End Sub
Private Sub Command9_Click()Dim c As Longc = Val(Text1.Text)Text1.Text = c * 10 + 3End Sub
Visual C++:// calculation.cpp : Implementation of Ccalculation
#include "stdafx.h"
#include "Calculator.h"
#include "calculation.h"
/////////////////////////////////////////////////////////////////////////////
// Ccalculation
STDMETHODIMP Ccalculation::add(int a, int b, long *c)
{
*c=a+b;
return S_OK;
}
STDMETHODIMP Ccalculation::sub(int a, int b, long *c)
{
*c=a-b;
return S_OK;
}
STDMETHODIMP Ccalculation::product(int a, int b, long *c)
{
*c=a*b;
return S_OK;
}
STDMETHODIMP Ccalculation::division(int a, int b, long *c)
{
*c=a/b;
return S_OK;
}
OUTPUT:
EmoticonEmoticon