c:
#include<stdio.h>
int main()
{
int score1;
int score2;
int score3;
scanf("%d %d %d",&score1,&score2,&score3);
printf("score1=%d,score2=%d,score3=%d",score1,score2,score3);
}
注:scanf的使用,有逗號,有&;
c++:
#include<bits/stdc++.h>
using namespace std;
int main(){
int score1;
int score2;
int score3;
cin>>score1>>score2>>score3;
cout<<"score1="<<score1<<",score2="<<score2
<<",score3="<<score3<<endl;
return 0;
}
注:cin的使用,>>;cout的使用。
Java:
import java.io.*;
public class Main{
public static void main(String[]args)throws IOException
{
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
//使用System.in建立BufferedReader
String[]strs=bf.readLine().split(" ");
System.out.printf("score1="+strs[0]+",score2="+strs[1]+",score3="+strs[2]);
}
注:這裏用到的庫,io.IOExpection io.BufferdReader io.InputStreamReader;註釋;split後的空格