CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

error: no match for ‘operator<=’

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 13, 2020, 06:02
Default error: no match for ‘operator<=’
  #1
New Member
 
marian enache
Join Date: Aug 2020
Posts: 1
Rep Power: 0
martinmarian is on a distinguished road
Hello. I am new to c++ and i get the error in the title. Can please someone let me know the mistakes i am doing? Bellow is the code.


#include<iostream>

using namespace std;


int main()

{
int a, b, c;


cout<<"input a value for a: ";
cin >> a;
cout<<"Input a value for b: ";
cin >> b;
cout << "Input a value for c: ";
cin >> c;
cout << endl;

cout << a + 2.5;
cout << a <= b;

return 0;
}
martinmarian is offline   Reply With Quote

Old   August 17, 2020, 23:43
Default
  #2
Senior Member
 
cdegroot's Avatar
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 17
cdegroot is on a distinguished road
You need to add parentheses around your logical expression:

Code:
cout << (a <= b);
The << operator has higher precedence so “cout << a” is evaluated before the <= operator.
__________________
Chris DeGroot, PhD, PEng
CEO, Maple Key Labs
www.maplekeylabs.com
cdegroot is offline   Reply With Quote

Reply

Tags
c++

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Errno = 1 in OpenFOAM rfiore1 OpenFOAM Bugs 2 November 1, 2022 17:35
createPatch Segmentation Fault (CORE DUMPED) sam.ho OpenFOAM Pre-Processing 2 April 21, 2014 02:01
Match Control and Symmetry Boundary Condtions in a quasi 2D calculation peterputer ANSYS Meshing & Geometry 0 May 15, 2012 08:53
gmsh2ToFoam sarajags_89 OpenFOAM 0 November 24, 2009 22:50
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 04:15


All times are GMT -4. The time now is 19:17.