Glenpl

multiplication table

Nov 14th, 2014
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <iomanip>
  4. using namespace std;
  5. HANDLE uchwyt = GetStdHandle(STD_OUTPUT_HANDLE);
  6. #define kolor SetConsoleTextAttribute(uchwyt,
  7. int main(){kolor 8);cout<<"*";kolor 6);cout<< " |";
  8.     cout<<"  "<<setw(2)<<  "1";for(int i=2;i<16;i++)
  9. cout<<" | "<<setw(2)<<  i;cout<<" |"<<endl;
  10. for(int i=1;i<80;i++)cout<<"-";cout<<endl;
  11.     for(int i=1;i<11;i++){kolor 6);cout<<setw(1)<<i;
  12.             if(i==10)cout << "| ";else cout<<" | ";kolor 7);
  13.             for(int j=1;j<16;j++){if((i*j) < 100){
  14.                     cout<<setw(3)<<i*j;kolor 6);cout<<" |";}else{
  15.                     cout << setw(4)<<i*j;kolor 6);cout<<"|";}kolor 7);}
  16.             cout <<endl;kolor 6);for(int i=1;i<80;i++)
  17.                 cout<<"-";kolor 7);if(i<10)cout<<endl;}cin.get();}
Advertisement
Add Comment
Please, Sign In to add comment