am i using the "while" function correctly? i'm still trying to work out the problems but i just want to make sure my "while" function is placed properly.
#include <iostream>
#include <cstring>
#include <list>
usingnamespace std;
int main()
{
int students;
while(students >= 1 || students <= 25)endl;
cout << "Enter in the number of students in the class: \n";
cin >> students;
cout << "Enter in a number that is no less than 1 and no more than 25: ";
cin.getline(names, 25);
cin.get();
cin.ignore(25,'\n')
int count = 0
while (count++ <= 25)
{cout<< count << endl;
if (count == 1)
break;
}
system("pause");
return 0;
}
#include <iostream>
#include <cstring>
#include <list>
usingnamespace std;
int main()
{
int students;
while(students >= 1 || students <= 25)endl;
cout << "Enter in the number of students in the class: \n";
cin >> students;
cout << "Enter in a number that is no less than 1 and no more than 25: ";
cin.getline(names, 25);
cin.get();
cin.ignore(25,'\n')
int count = 0
while (count++ <= 25)
{
cout<< count << endl;
if (count == 1)
break;
}
system("pause");
return 0;
}
You also need to include the brackets in your first while loop, as it is looping nothing.
If you can do that it would be significantly easier to help you with the rest of your errors.
Edit: By the way I just indented the things I assumed needed indented -- I'm not sure what you really wanted in the while statement.
#include <iostream>
#include <cstring>
#include <list>
usingnamespace std;
int main()
{
int students;
cout << "Enter in the number of students in the class: \n";
cin >> students;
while(students >= 1 || students <= 25)endl;
cout << "Enter in a number that is no less than 1 and no more than 25: ";
cin.getline(names, 25);
cin.get();
cin.ignore(25,'\n')
student++;
while (count++ <= 25)
{
cout<< count << endl;
if (count == 1)
break;
}
system("pause");
return 0;
}