help conversion to c++

hi all

how can we write this in c++?

#include <stdio.h>
#include <stdlib.h>
typedef struct {
int x, y;
} * Point;

void init (Point p) {p->x = 0; p->y = 0;}
void set (Point p, int a, int b) {p->x = a; p->y = b;}
void showw (Point p) {printf("%d %d\n", p->x, p->y);}
main(){
Point p = (Point) malloc(8),
q = (Point) malloc(8);
init(p);
set(q, 1, 2);
showw(p);
printf("%d %d\n", q->x, q->y);
}


thanks in advance
Last edited on
Topic archived. No new replies allowed.