***Edit** New error:
Code:
#include <iostream>
#include <cstring>
#include <windows.h>
#include <stdlib.h>
#include <time.h>
#include <mmsystem.h>
using namespace std;
int ans1int=0;
int ans2int=0;
int ans3int=1;
char ans1[4];
char ans2[4];
char f1[2];
char f2[2];
char m1[2];
char m2[2];
char f1f2[10];
char m1m2[10];
char f1m1[10];
char f1m2[10];
char f2m2[10];
char f2m1[10];
int main()
{
while(ans3int==1){
while(ans1int==0){
cout<<"Fathers code - letter 1"<<endl;
cin.getline(f1, 2);
cout<<"Fathers code - letter 2"<<endl;
cin.getline(f2, 2);
strcat (f1f2, f1);
strcat (f1f2, f2);
cout<<"Your father is "<<f1f2<<" correct? [Yes/No]"<<endl;
cin.getline(ans1, 4);
if (strcmp(ans1, "Yes")==0 || strcmp(ans1, "yes")==0)
ans1int=1;
}
When I say no instead of yes, it gives me HhhH (or whatever I input), example: I say Hh the first time, then say no. So I go through again saying hH, and it should say hH back to me, but instead it says HhhH.
How do I clear a char?