Answers for "if ( ) c++"

C++
5

c++ if in equivalent

#include <algorithm>
#include <vector>

if ( std::find(vec.begin(), vec.end(), item) != vec.end() )
   do_this();
else
   do_that();
Posted by: Guest on July-09-2020
0

C++ if else

#include<iostream>
using namespace std;

int main()
{
    int grade;

    cin >> grade;

    if( grade >= 60 )
    {
        cout << "You Pass!" << endl;
    }
    else
    {
        cout << "You Fail..." << endl;
    }

    return 0;
}
Posted by: Guest on September-19-2020

Browse Popular Code Answers by Language