SHARE
TWEET

Untitled

a guest Nov 14th, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // cz2.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <string>
  7.  
  8. using std::cout;
  9. using std::cin;
  10. using std::endl;
  11. using std::string;
  12.  
  13. int main()
  14. {
  15.     const int len = 10;
  16.     string zadania[len];
  17.  
  18.     for (int i = 0; i < len; i++)
  19.     {
  20.         cout << "Enter the task " << i+1 << ": ";
  21.         cin >> zadania[i];
  22.     }
  23.  
  24.     int edit;
  25.     cout << "Enter number to edit: ";
  26.     cin >> edit;
  27.  
  28.     if(edit > 0 && edit < len)
  29.         cin >> zadania[edit];
  30.  
  31.     for (int i = 0; i < len; i++)
  32.     {
  33.         cout << "Zadanie " << i + 1 << ": " << zadania[i] << endl;
  34.     }
  35.    
  36.     int del;
  37.     cout << "Enter number to delete: ";
  38.     cin >> del;
  39.  
  40.     if (del > 0 && del < len)
  41.     {
  42.        
  43.         for (int i = 0; i < del; i++)
  44.         {
  45.             cout << "Zadanie " << i + 1 << ": " << zadania[i] << endl;
  46.         }
  47.         for (int i = del+1; i < len; i++)
  48.         {
  49.             cout << "Zadanie " << i + 1 << ": " << zadania[i] << endl;
  50.         }
  51.     }
  52.     return 0;
  53. }
RAW Paste Data
Top