Firstly, write a function
void line( char ch, int num)
which outputs the character ch num times in a row on a given line.
Secondly, write a function
void rectangle (char ch, int x, int y)
which writes the character ch in a rectangular pattern of x rows and y columns.
Thirdly, write a main body to read one character at a time from animals.dat.Th eprogram should produce a rectangular pattern for each letter in the animals name; the size of the rectangular pattern depends on the letter and on its position in the animal name, the rule being: if the x th letter in the name is the y th letter of the alphabet, the rectangle should be size x by y.
This is what i got so far . Thank you for the help
#include <iostream>
#include <fstream>
using namespace std;
void line(ofstream &fout, char ch, int x);
void rectangle (ofstream &fout, char ch , int x, int y);
void line(ofstream &fout, char ch, int x)
{
for(int i=1; i<=x;i++)
{
cout<<ch;
fout<<ch;
}
}
void rectangle (ofstream &fout, char ch , int x, int y)
{
line(ch,num);
for(int j=1; j=y; j++)
{
cout<<endl<<endl;
fout<<endl<<endl;
}
}
int main()
{
ifstream fin;
ofstream fout;
fin.open("animals.dat");
int i,j,y;
for(int j=1; j=y; j++)
{
cout<<endl<<endl;
cout<<endl<<endl;
}
return 0;
}

New Topic/Question
Reply




MultiQuote




|