/*
Nome: Mario
Cognome: Montanari

strncat()
*/

#include <iostream>
#include <cstring>

#define SIZE 100+1

using namespace std;

char *strncat(char *dst, const char *src, int n);

int main(void) {
	char src[SIZE] = "mario.montanari@studenti.itisravenna.it";
	char dst[SIZE];
	char *ptr;
	
	ptr = strncat(dst, src, 15);
	
	cout << src << endl;
	cout << ptr << endl;
	
	return 0;
}

char *strncat(char *dst, const char *src, int n) {
	const char *ptr = dst;
	
	while (*dst) {
		*dst++;
	}
	
	while (n > 0 && *src) {
		*dst = *src;
		dst++;
		src++;
		n--;
	}
	
	*dst = '\0';
	
	return (char*)ptr;
}