Why is it repeating?
#include{iostream.h)
int main()
{
char line[12];
char line2[6];
cout ltlt "Enter the first string: " ltlt endl;
cin.getline(line,12);
cout ltlt "Enter the 2nd string: "ltlt endl;
cin.getline(line2,6);
{
for(int i = 0; line[i] != '\0'; ++i)
for(int j = 0; line2[j] != '\0'; ++j)
cout ltlt line ltlt line2;
}
return 0;
}
inputing: hello and then world
why am i repeating?
(lt= less than)
int main()
{
char line[12];
char line2[6];
cout ltlt "Enter the first string: " ltlt endl;
cin.getline(line,12);
cout ltlt "Enter the 2nd string: "ltlt endl;
cin.getline(line2,6);
{
for(int i = 0; line[i] != '\0'; ++i)
for(int j = 0; line2[j] != '\0'; ++j)
cout ltlt line ltlt line2;
}
return 0;
}
inputing: hello and then world
why am i repeating?
(lt= less than)
