New to programming my user name sums it all up!!!
trying to creat a DLL for a calculator (in C#) I'm told this code below will do the trick, but it doesn't build!! can anybody out there tell me why?

using System;
using System.Collections.Generic;
using System.Text;

namespace neilsuperDLL
{
public class calc
{
public float Calculate(float a, float b, int func)
{
float f;
switch(func)
{


case1:
f = a + b;
break;

case 2:
f = a - b;
break;

Case 3:
f = a * b;
break;

case 4:
f = a / b;
break;

default:
f =0.0F;
break;
}
return f;

}


}
}

Recommended Answers

All 2 Replies

You made some syntax errors.
case1: needs a space between case and 1
Case 3: should not be capitalized.

This looks kind of like a homework assignment. Did you even check to see what errors were thrown when you attempted to build? These errors are so easy that they should have jumped right out at you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.