早教吧 育儿知识 作业答案 考试题库 百科 知识分享

程序改错题,//实验二(1)#include#includeintmain()/*Pre:Theusersuppliesanintegernandndecimalnumbers.Post:Thenumbersareprintedinreverseorder.Uses:TheSTLclassstackanditsmethods*/{\x05intn;\x05doubleitem;\x05stacknu

题目详情
程序改错题,
//实验二(1)
#include
#include
int main( )
/* Pre:The user supplies an integer n and n decimal numbers.
Post:The numbers are printed in reverse order.
Uses:The STL class stack and its methods */
{
\x05int n;
\x05double item;
\x05stack numbers; // declares and initializes a stack of numbers
\x05cout item;
\x05\x05numbers.push(item);
\x05}
\x05cout
▼优质解答
答案和解析
#include
#include
using namespace std;
int main( )
/* Pre:The user supplies an integer n and n decimal numbers.
Post:The numbers are printed in reverse order.
Uses:The STL class stack and its methods */
{
\x05int n;
\x05double item;
\x05stack numbers; // declares and initializes a stack of numbers
\x05cout item;
\x05\x05numbers.push(item);
\x05}
\x05cout