squarebiz2 - /get a width from a file infile>>width...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//The fstream library is used to read from a file . #include <fstream> using namespace std; int main() { //variable declerations int row, col, width; int i; ofstream outfile; ifstream infile; infile.open("squarebiz2.in"); outfile.open("squarebiz2.out"); for(i=0; i<3; i++) {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //get a width from a file infile>>width; for(row=0; row<width; row++) for(col=0; col<width; col++) if((row==0)||(row==width-1)||(col==0)||(col==width-1)) outfile<< "*"; else outfile<<" "<<endl; } infile.close(); outfile.close(); return 0; }...
View Full Document

This document was uploaded on 05/01/2011.

Ask a homework question - tutors are online