Programming and Graphics

(Kiana) #1

328 Introduction to C++ Programming and Graphics


Matlab Fortran 77 CandC++

== ===
< .lt. <
<= .le. <=
> .gt. >
>= .ge. >=
∼= .ne. !=
& .and. &&
| .or. ||

Table C.1 Relational and logical operands inMatlab,Fortran 77, and C++.
TheMatlaband C++ columns are nearly identical.


#include<iostream>
using namespace std;

int main()
{
cout << "Hello Themistocles \n";
return 0;
}

The output of the code is:


Hello Themistocles

InMatlab, the same code consists of one line alone:


disp "Hello Themistocles"

InFortran 77, the same code consists of two lines:


write (6,*) "Hello Themistocles"
end

Note that six blank spaces must be inserted at the beginning of each line.

Free download pdf