I have heard about the:
char myline[100];
cin.getline(myline,100);
but when my coding is long it doesnt work i gues as long as i would like it to?
here is my code for example:
#include <iostream>
using namespace std;
int main()
{
int length;
int width;
cout << "Enter the length: ";
cin >> length;
cout << "Enter the width: ";
cin >> width;
cout << "The area is "; <---- This is the problem, when it gets here it just closes...
cout << length*width;
char myline[100]; <----- Does it have to do with this?
cin.getline(myline,100);
return 0;
}
Yes i am extremely new to programming and i am trying to learn it, but there is a problem.
When i enter the two variables from my keyboard, and it gets to the part where it should say "The area is " and show my answer, the program just shuts off... Does this have to do with the char myline? Someone please help.