2d char help?

How would i put the smiley face on top of the *?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  #include <iostream>
using namespace std;
int main( )
{
    char life [4][4]={"\0"};
    int a,b;
    life[2][3]=(char)1;
    
    for(a=0; a<4; a++)
    {
    	
    	for(b=0; b<4; b++)
    	{
    		cout<<life[a][b];
    		cout<<"*";
		}
    	cout<<endl;
	}
    return 0;
}
Is this what you're looking for?

1
2
3
4
    if(life[a][b] == 1)
        cout<<life[a][b];
    else
        cout<<"*";
Could you explain what you mean by "smiley face"?
@andres81

Run this code and see what it does:

1
2
3
4
5
6
7
8
#include <iostream>

int main()
{
    std::cout << (char) 1 << "  " << (char) 2 << std::endl;
    return 0;
}
Topic archived. No new replies allowed.