Skip to main content

[Code C/C++] Truck in 2D Array

1. This is a program for Truck in 2D Array
TRUCK-IN-2D-ARRAY
TRUCK-IN-2D-ARRAY

2. Download Source Code
:  Here
3. Code:
#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
 int i, j, t;
 float s = 0, a, b;
 _getch();
 for (t = -72; t<62; ++t)
 {
  system("cls");
  for (i = 0; i<15; ++i)
  {
   cout << endl;
  }
  for (i = 0; i<17; ++i)
  {
   for (j = 0; j<78; ++j)
   {
    if (((j + t == 20 || j + t == 59) && i != 0) || (i == 0 && j + t<59 && j + t>20) || (i == 5 && j + t<20 && j + t>14) || (j + t == 20 - i&&i >= 5 && i <= 10) || (i>10 && j + t == 10) || (i == 16 && j + t>10 && j + t<60) || (i == 10 && j + t<20 && j + t>10) || (i == 15 && j + t<60 && j + t>20) || (j + t == 15 && i<10 && i>5) || (i == 12 && j + t>11 && j + t<15) || (i == 13 && (j + t == 12 || j + t == 13)))
     cout << "*";
    else
     cout << " ";
   }
   cout << endl;
  }
  for (i = 0; i<4; ++i)
  {
   for (j = 0; j<78; ++j)
   {
    if (((i == 0 || i == 3) && (j + t == 15 || j + t == 16 || j + t == 54 || j + t == 55 || j + t == 49 || j + t == 50 || j + t == 44 || j + t == 45)) || ((i == 2 || i == 1) && ((j + t>13 && j + t<18) || (j + t>52 && j + t<57) || (j + t>47 && j + t<52) || (j + t>42 && j + t<47))))
     cout << "*";
    else
     cout << " ";
   }
   cout << endl;
  }
  for (j = 0; j<80; ++j)
   cout << "*";
  for (a = 0; a<10000; ++a)
  {
   s = s + a;
   for (b = 0; b<1000; ++b)
    s = s + b;
  }

 }
 _getch();
}

Comments

Popular posts from this blog

Socket Android Client to PC Server C#

Using AsynCallback C# Android Client connect Server C# Source code:  http://ow.ly/OlXj309O1mj c# socket multi client, socket c# example, socket server c#, socket c# tutorial, asynchronous socket in c#, c# socket multiple clients, c# socket server multiple clients, Download source code:  Click Here

Bài tập thuật toán C/C++ Và Tuyển tập đề thi olympic

Gồm: +  Các thuật toán của Lê Minh Hoàng + Tuyển tập các đề thi olympic tin học sinh viên Link down: Tại đây

Cross Platform Mobile App: Demo shop with flutter

Cross Platform Mobile App: Demo shop with flutter So cool framework from google <3  Demo:  Demo Code console.print("hello")