home > 写経編 > 柴田望洋『明解C言語 入門編』 > 1. まずは慣れよう >

ForNext

Only Do What Only You Can Do

003. 2つの変数に整数値を格納して表示

VBScript

JScript

Perl

更新日 : 2010.10.18
$vx = 57;
$vy = $vx + 10;

print "vxの値は$vxです。\n";
print "vyの値は$vyです。\n";
L:\>perl lesson_01_003.pl
vxの値は57です。
vyの値は67です。

PHP

更新日 : 2010.11.03
<?php
$vx = 57;
$vy = $vx + 10;

print "vxの値は$vxです。\n";
echo  "vyの値は$vyです。\n";

print "vxの値は$vx です。\n";
echo  "vyの値は$vy です。\n";
?>
L:\>php lesson_01_003.php
vxの値は
vyの値は
vxの値は57 です。
vyの値は67 です。

Python

更新日 : 2010.11.17
# coding: Shift_JIS

vx = 57
vy = vx + 10

print "vxの値は%dです。" % vx
print "vyの値は%dです。" % vy
N:\>python lesson_01_003.py
vxの値は57です。
vyの値は67です。

Ruby

更新日 : 2010.11.01
vx = 57
vy = vx + 10

print "vxの値は#{vx}です。\n"
print "vyの値は#{vy}です。\n"
L:\>ruby  l:\lesson_01_003.rb
vxの値は57です。
vyの値は67です。

PowerShell

Scala

F#

C

更新日 : 2010.10.08
#include <stdio.h>
int main(int argc, char* argv[])
{
    int vx, vy;

    vx = 57;
    vy = vx + 10;

    printf("vxの値は%dです。\n", vx);
    printf("vyの値は%dです。\n", vy);

    return 0;
}
R:\>lesson003\project1.exe
vxの値は57です。
vyの値は67です。

C++

更新日 : 2010.10.13
#include <iostream.h>

int main(int argc, char* argv[])
{
    int vx, vy;

    vx = 57;
    vy = vx + 10;

    cout << "vxの値は" << vx << "です。\n";
    cout << "vyの値は" << vy << "です。\n";

    return 0;
}
T:\>lesson003\project1.exe
vxの値は57です。
vyの値は67です。

C++Builder

VC++

C#

Java

更新日 : 2010.11.05
class Lesson003 {
    public static void main(String[] args) {
        int vx, vy;

        vx = 57;
        vy = vx + 10;

        System.out.printf("vxの値は%dです。\n", vx);
        System.out.printf("vyの値は%dです。\n", vy);
    }
}
L:\>java Lesson003
vxの値は57です。
vyの値は67です。

Objective-C

D

VB

VB.NET

Delphi

更新日 : 2010.09.24
program Project1;

{$APPTYPE CONSOLE}

uses
    SysUtils;
var
    vx, vy: Integer;
begin
    vx := 57;
    vy := vx + 10;

    write(format('vxの値は%dです。'#13#10, [vx]));
    write(format('vyの値は%dです。'#13#10, [vy]));
end.
S:\>lesson003\project1.exe
vxの値は57です。
vyの値は67です。

Ada

PL/SQL

T-SQL

関数型

inserted by FC2 system