I'm having trouble trying to truncate a character array. I tried to use cin.getline but that didn't work. I also tried to assign temp1 to temp2 but that also didn't work. Any suggestions would be greatly appreciated.
Code:
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
void main()
{
char temp1[26];
char temp2[11];
cout<<"Please enter a password no more than 25 characters in length: ";
cin>>temp1;
cout<<temp1;
cin.getline(temp1, 11);
//temp2=temp1;
cout<<temp1<<endl;
getch();
}
[code][/code]tagged by Salem
Shame about the lack of indentation though...