1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

"1週間で身に付くC++言語の基本"をといてみた

Last updated at Posted at 2020-01-31

http://cpp-lang.sevendays-study.com/problem1.html
をといてみた。
1-1

# include <iostream>

using namespace std;

int main()
{
        cout << "C++\n";
        return 0;
}

1-2

# include <iostream>

int main()
{
        std::cout << "prigramming in C++ Language" << std::endl;
        return 0;
}

1-3

# include <iostream>

using namespace std;

int main()
{
    cout << "ONE TWO THREE" << endl << "FOUR FIVE SIX" << endl;
    return 0;
}

1-4

# include <iostream>

using namespace std;

int main()
{
        cout << "数値を入力してください: ";
        int a;
        cin >> a;
        cout << a << "を2倍した数は、10です。" << endl;

    return 0;
}

1-5

# include <iostream>

using namespace std;

int main()
{
        int a[2];
        for (int i = 0; i < 2; i++) {
                cout << i << "つ目の数:";
                cin >> a[i];
        }

        cout << a[0] << "+" << a[1] << "=" << a[0]+a[1] << endl;
        cout << a[0] << "-" << a[1] << "=" << a[0]-a[1] << endl;

    return 0;
}

1-6

# include <iostream>

using namespace std;

int main()
{
        char a[2][256];
        cout << "姓を入力:";
        cin >> a[0];
        cout << "名を入力:";
        cin >> a[1];
        cout << "名前は「" << a[0] << a[1] << "」です。" << endl;

    return 0;
}

1-7

# include <iostream>

using namespace std;
int main(){
    cout << "HelloWorld." << endl;
}
1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?