#include <iostream>
#include <fstream>
#include <cstdlib>
#include <conio.h>
#include <iomanip>
#include <ctype.h>
#include <windows.h>
#include <cstring>
#include <ctime>
using namespace std;
int main()
{
ofstream outputparticulars("particulars.txt",ios::out);
int d,a,b,c;
char ic[100],password[100],confirmpassword[100];
char info[6][101];
cin>>d;
if(d==1)
{cout<<"1"<<endl;
}
else if(d==3)
{
cout<<" Key in your......\n";
cout<<" First Name : ";
cin.getline(info[0],100);
outputparticulars<<" Name : "<<info[0]<<endl;
cout<<" IC Number (with the hyphens, eg: 910101-07-1111) : ";
cin.getline(info[1],100);
outputparticulars<<" IC Number (with the hyphens, eg: 910101-07-1111) : "<<info[1]<<endl;
cout<<" Matric Number : ";
cin.getline(info[2],100);
outputparticulars<<" Matric no : "<<info[2]<<endl;
cout<<" Course : ";
cin.getline(info[3],100);
outputparticulars<<" Course : "<<info[3]<<endl;
cout<<" Please enter your desired password (Case Sensitive) : "<<endl;
cin.getline(password,100);
cout<<" Please re-confirm your password (Case Sensitive) : "<<endl;
cin.getline(confirmpassword,100);
}
}
i got a strange output. why is this so?? if i cancel the IF condition. the program runs the way that i want. can anyone help me with this??? I've been thinking and doing this problem for 5hours and i cant find out what's wrong.