Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to do implied do loops on write statements in C++ ?

18 views
Skip to first unread message

Lynn McGuire

unread,
Nov 5, 2022, 4:17:05 PM11/5/22
to
In converting my F77 code to C++, I am wondering how to do implied do
loops on write statements in C / C++ ?

write (oufile, 54555) (xyz (i), i = 1, ncp)
54555 format ('xyz=', (1x, g14.7), /)

Thanks,
Lynn


Michael S

unread,
Nov 5, 2022, 4:29:43 PM11/5/22
to
There is no direct equivalent in C++ .
You can use non-direct equivalents like like std::for_each(),
but if you value your sanity, please do not.
Just write explicit for() loop.

Bonita Montero

unread,
Nov 5, 2022, 4:35:53 PM11/5/22
to
Am 05.11.2022 um 21:29 schrieb Michael S:

> There is no direct equivalent in C++ .
> You can use non-direct equivalents like like std::for_each(),
> but if you value your sanity, please do not.
> Just write explicit for() loop.

I use for_each sometimes when it's shorter.


Lynn McGuire

unread,
Nov 5, 2022, 8:05:00 PM11/5/22
to
That is what I do now.

Thanks,
Lynn
0 new messages