Advertisement
Guest User

lab2

a guest
May 29th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.97 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. #include <fstream>
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <iomanip>
  7. #include <cstdlib>
  8. using namespace std;
  9. int main(int argc, char** argv) {
  10.     setlocale(LC_ALL, "RUSSIAN");
  11.     const char separator    = ' ';
  12.     const int headerWidth = 20;
  13.     const int nameWidth     = 14;
  14.     string processor[10], frequency[10], ram[10], type[10];
  15.     int count;
  16.     int i = 0;
  17.     cout << "Введите кол-вол данных:  " << endl;
  18.     cin >> count;
  19.     while (i != count){
  20.         cout << "Введите данные " << i+1 << "-го процессора (Название процессора, частоту, RAM, тип)." << endl;
  21.         cin >> processor[i] >> frequency[i] >> ram[i] >> type[i];
  22.         i++;
  23.     }
  24.     system("cls");
  25.     //HEADER
  26.     cout << left << setw(nameWidth) << setfill(separator) << "";
  27.     cout << left << setw(nameWidth) << setfill(separator) << "";
  28.     cout << left << setw(headerWidth) << setfill(separator) << "ХАРАКТЕРИСТИКИ ПЭВМ";
  29.     cout << "\n";
  30.     cout << left << setw(nameWidth) << setfill(separator) << "";
  31.     cout << left << setw(nameWidth) << setfill(separator) << "Процессор";
  32.     cout << left << setw(nameWidth) << setfill(separator) << "Частота (Mgz)";
  33.     cout << left << setw(nameWidth) << setfill(separator) << "RAM (mb)";
  34.     cout << left << setw(nameWidth) << setfill(separator) << "Type";
  35.     cout << "\n";
  36.     //
  37.     i = 0;
  38.     while(i != count){
  39.         cout << left << setw(nameWidth) << setfill(separator) << "";
  40.         cout << left << setw(nameWidth) << setfill(separator) << processor[i];
  41.         cout << left << setw(nameWidth) << setfill(separator) << frequency[i];
  42.         cout << left << setw(nameWidth) << setfill(separator) << ram[i];
  43.         cout << left << setw(nameWidth) << setfill(separator) << type[i];
  44.         cout << "\n";
  45.         i++;
  46.     }
  47.     cout << left << setw(nameWidth) << setfill(separator) << "";
  48.     cout << left << setw(nameWidth) << setfill(separator) << "Тип: C - CISC-процессор, R - RISC-процессор";
  49.     return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement