#include <bits/stdc++.h> using namespace std; int main() { long int a,b,count=0; cin>>a>>b; for(long int i=1; i<=__gcd(a,b);i++){ if((a%i==0)&&(b%==0)){ count++; } } if(((a%b==0)||(b%a==0))&&(a!=b)){ cout<<count; } return 0; } In function ‘int main()’: 11:20: error: expected primary-expression before ‘=’ token Source: Windows Que..

#### Category : expression

I’m reading C++ISO and I got overwhelmed by some information. discarded-value expression: In some contexts, an expression only appears for its side effects. Such an expression is called a discarded-value expression. side effects: Reading an object designated by a volatile glvalue (7.2.1), modifying an object, calling a library I/O function, or calling a function that ..

I wrote this code to evaluate postfix expressions, but in this code I can only evaluate an expression with only single-digit numbers. I want to edit this code for it to evaluate multi-digit numbers. How can I do this? #include <iostream> #include <stack> #include <string> using namespace std; float calc(float o1,float o2,char c) { if(c==’+’) ..

The C++11 standard introduced the following definitions of the value categories of expressions in [basic.lval/1] (bold emphasis mine): An lvalue (so called, historically, because lvalues could appear on the left-hand side of an assignment expression) designates a function or an object. [ Example: If E is an expression of pointer type, then *E is an ..

I have a mathematical expression such as: expression = function123(v1, v2) and I want to transform it to: expression = (function1(v1, v2) + function2(v1, v2) + function3(v1, v2)) In order to solve this problem, I tried to utilize regular expressions, such as: "function123(([^)]+),([^)]+))" and replace using the interior tokens to get what I want. Regular ..

I have a mathematical expression such as: expression = function123(v1, v2) and I want to transform it to: expression = (function1(v1, v2) + function2(v1, v2) + function3(v1, v2)) In order to solve this problem, I tried to utilize regular expressions, such as: "function123(([^)]+),([^)]+))" and replace using the interior tokens to get what I want. Regular ..

I’m making a compiler in C++ and I’ve cursed myself (sorta) to have to define functions to use iterators and take as much as they need. We feed the functions iterator references and if the function succeeds to parse the expression, we set the reference and return true, else we leave the reference and return ..

I have two different structs in c file, struct A and B: typedef Struct _A { float arr[4]; }A; typedef struct _B { float const x; float const y; }B; A* objA = (A*)malloc(sizeof(A)); B* objB = (B*)malloc(sizeof(B)); what I need to do is assign arr values with values from struct B objA->arr = {objB->x, ..

Bit of a long read, It’s my first question here 🙂 So, I want a function or the logic, whereby the code is able to validate an expression whether it is Infix, Postfix, or Prefix Accurately. So by accurate I mean it should check all conditions whether the expression itself is valid, what the expression ..

I have code like the following: if (simple_bool || expensive_func()) { // do something } will I be sure that the simple_bool will first be checked before the expensive_func()? Source: Windows Que..

## Recent Comments