Where is the problem?? C++

This function is supposed to write squares like.
when you enter 3
+-+
| |
+-+ or when you enter 5

+---+
| |
| |
| |
+---+
I believe this code have lots of error, so anybody can help me please to fix them?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
using namespace std;
int getInput(void){
int s;
do{
    ;
    cout<<" Enter length between 0 and 64 (-1 to exit): "<<endl;
    cin>>s;
    cout<<" Length Entered: "<<s<<endl;
}
while( (s<-1)||(s>64));
    return s;
}
void pritline(char A,char B,int n){
for(int i=1;i<=n;i++)
if(i==1||i==n)cout<<A;
else
cout<<B;
}
void printStats(int N,int s){
cout<<N<<"squares are printed. Their average="<<(s/N)<<endl;
}
int main(){
    int sum=0, N=0;
    while(1)
    {
    int p=getInput();
    if(p==-1)break;
    sum+=p; N++;
    for(int i=1;i<=p;i++)
    if(i==1||i==p)
    void printline('+','+',p);
    else 
    void printline('+','-',p);
    }
    void printStats(int N,int s);
    
    system("pause");
    return 0;
    }
Last edited on
Topic archived. No new replies allowed.