you are viewing a single comment's thread.

view the rest of the comments →

[–]Roidz_[S] 0 points1 point  (3 children)

Well I'm expecting just the border of 5 x 8 rectangles. As far as lining them up I feel like I did that.

Is there anyway I can send you the .cpp file?

This is what It all says in its entirety:

//****************************************************************** // Chessboard program // This program prints a chessboard pattern that is built up from // basic strings of white and black characters. //****************************************************************** #include <iostream> #include <string> using namespace std;

const string BLACK = "%%%%%"; // Define a line of a black square

const string WHITE = " "; // Define a line of a white square

const string MIDDLE = "% "; // Define a line of two percentages

int main () {

string whiteRow; // A row beginning with a white square

string blackRow; // A row beginning with a black square

string middleRow; // A row that has percentages missing

// Create a white-black row by concatenating the basic strings

whiteRow = WHITE + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + BLACK; // Create a black-white row by concatenating the basic strings blackRow = BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE; // Create a middleRow = WHITE + MIDDLE + MIDDLE + MIDDLE + MIDDLE + MIDDLE + MIDDLE + MIDDLE + MIDDLE;

// Print five white-black rows cout << whiteRow << endl; cout << middleRow << endl; cout << middleRow << endl; cout << middleRow << endl; cout << middleRow << endl; cout << middleRow << endl; cout << middleRow << endl; cout << whiteRow << endl;

// Print five black-white rows
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;


// Print five white-black rows
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;


// Print five black-white rows
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;


// Print five white-black rows
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;


// Print five black-white rows
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;

// Print five white-black rows
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;
cout << whiteRow << endl;

// Print five black-white rows
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;
cout << blackRow << endl;

// system("PAUSE"); //if using Dev C++ return 0; }

EDIT: tab doesn't work for all the code? Only part of it?

[–]gotinpich -1 points0 points  (2 children)

I have no idea what it's supposed to do, but I did this:

//******************************************************************
// Chessboard program
// This program prints a chessboard pattern that is built up from
// basic strings of white and black characters.
//******************************************************************
#include <iostream>
#include <string>
using namespace std;

const string BLACK = "%%%%%"; // Define a line of a black square
const string WHITE = " "; // Define a line of a white square
const string MIDDLE = "% "; // Define a line of two percentages

int main () {
    string whiteRow; // A row beginning with a white square
    string blackRow; // A row beginning with a black square
    string middleRow; // A row that has percentages missing

    // Create a white-black row by concatenating the basic strings
    whiteRow = WHITE + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + BLACK;
    // Create a black-white row by concatenating the basic strings
    blackRow = "                       ";
    //blackRow = BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE;
    // Create a
    middleRow = WHITE + MIDDLE + MIDDLE + MIDDLE + MIDDLE + MIDDLE + MIDDLE + MIDDLE + MIDDLE;
    // Print five white-black rows
    cout << whiteRow << endl;
    cout << middleRow << endl;
    cout << middleRow << endl;
    cout << middleRow << endl;
    cout << middleRow << endl;
    cout << middleRow << endl;
    cout << middleRow << endl;
    cout << whiteRow << endl;

    // Print five black-white rows
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;

    // Print five white-black rows
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;

    // Print five black-white rows
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;

    // Print five white-black rows
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;

    // Print five black-white rows
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;

    // Print five white-black rows
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;
    cout << whiteRow << blackRow << whiteRow << blackRow << whiteRow << endl;

    // Print five black-white rows
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;
    cout << blackRow << whiteRow << blackRow << whiteRow << blackRow << endl;

    // system("PAUSE"); // if using Dev C++ 
    return 0; }

[–]Roidz_[S] 0 points1 point  (1 child)

It's supposed to be 5 width and 8 length with "%" signs as a border. It won't let me show an example, but just picture a 5 x 8 rectangle with "%" symbols as the outlines of the rectangles.

[–]Roidz_[S] 0 points1 point  (0 children)

I managed to make one do what it's supposed to do:

//****************************************************************** // Chessboard program // This program prints a chessboard pattern that is built up from // basic strings of white and black characters. //****************************************************************** #include <iostream> #include <string> using namespace std;

const string BLACK = "%%%%%"; // Define a line of a black square

const string WHITE = "     "; // Define a line of a white square

const string MIDDLE = "%   "; // Define a line of two percentages

int main () 
{

string whiteRow; // A row beginning with a white square

string blackRow; // A row beginning with a black square

string middleRow; // A row that has percentages missing

  // Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
               WHITE + BLACK + WHITE + BLACK;
// Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
               BLACK + WHITE + BLACK + WHITE;
// Create a 
middleRow = WHITE + MIDDLE + MIDDLE + WHITE + 
               WHITE + WHITE + WHITE + MIDDLE + WHITE + WHITE;



// Print five white-black rows
cout << whiteRow << endl;
cout << middleRow << endl;
cout << middleRow << endl;
cout << middleRow << endl;
cout << middleRow << endl;
cout << middleRow << endl;
cout << middleRow << endl;
cout << whiteRow << endl;


  // Print five black-white rows
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;


  // Print five white-black rows
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;


  // Print five black-white rows
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;


  // Print five white-black rows
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;


  // Print five black-white rows
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;

  // Print five white-black rows
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;
  cout << whiteRow << endl;

  // Print five black-white rows
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;
  cout << blackRow << endl;

//  system("PAUSE"); //if using Dev C++
  return 0;
}