maybe,
if((float)variable)
{
cout << "you entered an invalid number, try again: ";
cin >> variable;
}
Type: Posts; User: Conspiracy
maybe,
if((float)variable)
{
cout << "you entered an invalid number, try again: ";
cin >> variable;
}
Maybe this?>>
#include <iomanip>
#include <string>
#include <iostream>
using namespace std;
int main ()
WTF?
Okay so I changed my code to this:
#include <iostream>
#include <fstream>
using namespace std;
class Date
{
I followed matsp and kcpilot's advice and changed my code to this:
#include <iostream>
#include <fstream>
using namespace std;
class Date
{
private:
int month;
Well it looks good to me too, but it just wont save what I want!! and about my error checking, am aware of what you mentioned but thats what my professor asked for, so am not going to torture myself...
Hello everybody.
I am having problems with this program:
#include <iostream>
#include <fstream>
using namespace std;
class Date
The error is not related to the pow function problem, its because you wrote <endl; and its <<endl;
And you get it for times because you have this part:
switch (response)
{
right++; //...
#include <iostream>
using namespace std;
int main()
{
int input;
cout<<"1. Play game\n";
cout<<"2. Load game\n";
int leftoperand, rightoperand, response, answer, studentanswer, grade
missing ;
int leftoperand, rightoperand, response, answer, studentanswer, grade;
char category, opt
No, that part is fine, the only warning the compiler gives is:
Warning 1 warning C4244: 'return' : conversion from 'int' to 'float', possible loss of...
Thanks for the advise Daved,
Thanks to you the program runs but theres a problem.
Heres the changed program:
#include <string>
#include <iostream>
using namespace std;
nope, it didint worked. I also tried this:
while(x < 1)
{
if(itemStockNumber == itemStockNumber.size(4))
++x;
else
cout << "The item's stock number must be a four digit number:...
oh sorry
if (itemStockNumber == itemStockNumber.length(4))
Thats my problem, you have to put 4 digits, if you dont put 4 digits the program has to keep asking for it until you enter 4 numbers,...
Hi everybody, am having problems with this program. Can anyone help me?
#include <string>
#include <iostream>
using namespace std;
class GroceryItem
{
Thanks for your help, and no, I dont know how to repeat the same section of code multiple times.
heres what I have, this takes 3 numbers and determines the greater number,
#include <iostream>
using namespace std;
int main ()
{
int n1, n2, n3;
sorry but am lost... I dont understand and am so frustrated. But thanks anyway.
Hello everybody am new here. Am starting with C++ and I have a homework I just cant figure it out. This may sound stupid but I need to do a program that takes 10 numbers and determines the greater...