Cpp - Write program to read data and output

Requirements

Write a program that reads an article number, a quantity, and a unit price from the keyboard.

Outputs the data on screen.

Demo

#include <iostream> 
#include <iomanip> 
using namespace std; 
int main() //from  ww w.  j  a va 2 s .c  o  m
{ 
    long number = 0; 
    int  count = 0; 
    double price = 0.0; 
    cout << "\nPlease enter article characteristics.\n"; 
    cout << "Article number:  "; 
    cin  >> number; 
    cout << "Number of pieces:      "; 
    cin  >> count; 
    cout << "Price per piece:     "; 
    cin  >> price; 

    cout << "\n\tArticle Number    Quantity    Price per piece "; 

    cout << "\n\t" 
          << setw(8)  << number 
          << setw(16) << count 
          << fixed    << setprecision(2) 
          << setw(16) << price << " Dollar" << endl; 

    return 0; 
}

Result