Re: flow control statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 24, 2019 at 8:18 AM Ali MURAT <alimupas2@xxxxxxxxx> wrote:
>
> I'm sorry if more than one unfinished email came to you somehow. because
> I noticed unfinished emails, and I am not be sure that you went to you.
>
> On 7/24/2019 8:56 AM, Ali MURAT wrote:
> >> you mean that you want to write a new language construct that extends
> >> the existing C language constructs?
> >
> > Yes, I have intent that improving the c language and I getting a new
> > idea as I  gain experience
> >
> > in the simplest form, when I want to calculating the number of cycles
> > of a consecutive number in the simplest, it easily did not be done
> > with this(for) command
> >
> > For example of
> > #------------------------------------------------------------------
> > // Example program
> > #include <iostream>
> > #include <string>
> > using namespace std;
> > int main()
> > {
> >  for (int i=1;i<=9;i+=2)
> >  {
> >      cout<<"hadi, bana sayiyi goster:"<<i<<endl;
> >      }
> > }
> > #------------------------------------------------------------------

Please be aware that you are using C++ language constructs, not C.
While C++ strives to be compatible with C (see
https://events.yandex.ru/lib/talks/1954/), C and C++ are different.

> > ----------------------------------
> > hadi, bana sayiyi goster:1 cycles of 0
> > hadi, bana sayiyi goster:3 cycles of 1
> > -----
> > hadi, bana sayiyi goster:9 cycles of 3
> >
> >
> > it here is end, but, I am not want this and I want as it is like follows.
> >
> > -------------------
> > hadi, bana sayiyi goster:1 cycles of 0
> > hadi, bana sayiyi goster:3 cycles of 1
> > -----
> > hadi, bana sayiyi goster:9 cycles of 3
> > ----
> > hadi, bana sayiyi goster:13 cycles of 5
> > hadi, bana sayiyi goster:19 cycles of 8
> > hadi, bana sayiyi goster:21 cycles(loop) of 9
> >
> > ----
> > I found the key(answer) of this in other way
> > increase amount:2
> > loop  amount:80
> > regular consecutive odd numbers:x+3
> > regular consecutive even numbers:x+4
> > solution way:
> > 80*2=160+((3) or (4))
> > ----------------------
> > düzensiz artan fakat artış miktarı düzenli olan bir sayı bloğu için
> > kolaylık sağlanabilir.
> > a number block that is irregularly increased but whose loop amount of
> > increase is regular may be facilitated.
> >
> >
> > So, the main point here is to introduce the number of loop to
> > this(for) command!
> >
> > As I write code, I come up with various ideas. they are simple but
> > necessary. when I work on more complex code, if I found anything I
> > share it for you to get an idea.
> >
> > anybody may have been experiencing such a problem. When writing code

You can achieve what you want with preprocessor macros (see
https://en.wikipedia.org/wiki/C_preprocessor).

If you have further questions on extending the C and C++ through
preprocessor macros, please browse
https://stackoverflow.com/questions/tagged/preprocessor-meta-program%20c-preprocessor?sort=Newest
and, if needed, ask there, not here due to this having nothing to do
with GCC anymore, which is a collection of compilers.

Thank you.

-- 
Best regards,
Tadeus




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux