+ 2
Why won’t ‘a’ be used as a function in cpp
I’m writhing this code and it won’t work the main function of it is basic math but it won’t work can someone explain to me what’s wrong and tell me the steps I need to take to complete it.
12 odpowiedzi
+ 3
I really, really think you can't do that. First of all, your second var is an integer, so it can't be a symbol. Second, there's no such syntax (at least I think so) in c++. What you could do is, after reading input, do "if" check for possible operation symbols and then do math in them.
if(b=='+'){
d = a + c;
}
else if(b=='-'){
d = a - c;
}
etc.
+ 5
Can you provide the code??
+ 3
When you write a comment, there should be "+Insert..." on the same panel in bottom left. Then instead of trending select your codes and pick one.
+ 2
To be fair, I have never seen anything like "(a) (b) (c) = (d);". How is it called and what is it supposed to do?
+ 1
Also how do you post a code on ios?
+ 1
How?
+ 1
I think I got it
#include <iostream>
using namespace std;
class MyClass{
public:
MyClass(int a, int b, int c, int d);
private:
const int shlong;
const int zillow;
int dankdankbaby;
int comunism;
};
MyClass::MyClass(int a, int b, int c, int d)
: shlong(b), zillow(d), dankdankbaby(c), comunism (a)
{
}
int main() {
int a, b, c, d;
cin >> a;
cin >> b;
cin >> c;
MyClass obj(a, b, c, d);
(a) (b) (c) = (d);
cout << d;
return 0;
}
+ 1
Yes I know that IV done it before on my tablet I’m now useing an iPad and it won’t work :(
0
A is a number b is a function like division multiplication addition and subtraction and c is the other number. D is the value of the equation and input has to be vertical like this
4
/
2
Or
10
/
5
And the output would be 2
0
Ok thanks
I was thinking I could avoid doing that because it would be time consuming for me
0
7779
0
5622