Учеба и наука

с++ - вопрос №836811

Напечатать сообщение «This is a C program» так, чтобы каждое слово располагалось в новой строке (указать не менее двух вариантов такого вывода).

ноябрь 18, 2013 г.

  • Всего ответов: 4

  • Uran Musabaev - аватарка

    Uran Musabaev

    493-й в Технологиях

    Вариант №1

    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>
    #include <iostream>
    #include <string.h>

    using namespace std;
    int main()
    {
    const char *wrd=«This is a C porgram»;
    int ch_sz=strlen(wrd)+1;
    for (size_t cnt=0;cnt!=ch_sz;++cnt)
    {
    cout <<wrd[cnt]<<endl;}
    system(«pause»);
    return 0;

    }

    ноябрь 20, 2013 г.
  • Uran Musabaev - аватарка

    Uran Musabaev

    493-й в Технологиях

    Вариант № 2

    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>
    #include <iostream>
    #include <string.h>

    using namespace std;
    int main()
    {
    string word=«This is a Cprogram»;
    for (int cnt=0;cnt!=word.size();++cnt)
    {
    cout <<word[cnt]<<endl;
    }
    system(«pause»);
    return 0;
    }

    ноябрь 20, 2013 г.
  • Uran Musabaev - аватарка

    Uran Musabaev

    493-й в Технологиях

    выф

    ноябрь 22, 2013 г.
  • Uran Musabaev - аватарка

    Uran Musabaev

    493-й в Технологиях

    Вариант №3

    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>
    #include <iostream>
    #include <string.h>
    #include <vector>

    using namespace std;
    int main()
    {
    string g=«This is a C program»;
    for (string::iterator cb=g.begin();cb!=g.end();++cb)
    {
    cout <<*cb<<endl;
    }

    system(«pause»);
    return 0;
    }

    ноябрь 22, 2013 г.

Похожие вопросы