C++编程题:编写一个程序,由用户输入一个含有5个单词的英文句子,按照用户的要求输出句中的第I个单词。 10
1个回答
展开全部
源码:
==============CODE===============
#!usr/bin/perl
print "Please enter a sentence containing 5 words:\n";
$sentence = <STDIN>;
print "\nWhich word do you want to print?\nEnter a number from 1 to 5:\n";
$num = <STDIN>;
@words = split /\s+/, $sentence;
print "The word is:\t$words[$num-1]\n";
==============CODE===============
==============CODE===============
#!usr/bin/perl
print "Please enter a sentence containing 5 words:\n";
$sentence = <STDIN>;
print "\nWhich word do you want to print?\nEnter a number from 1 to 5:\n";
$num = <STDIN>;
@words = split /\s+/, $sentence;
print "The word is:\t$words[$num-1]\n";
==============CODE===============
追问
是C++编程题
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询