Forum: C++ Apr 17th, 2009 |
| Replies: 19 Views: 868 Look at the code here:
if (pos != -1)
{
goto badsearch;
}
I think you meant:
if (pos == -1) |
Forum: C++ Apr 14th, 2009 |
| Replies: 7 Views: 686 That's weird - it works perfect for me. |
Forum: C++ Apr 12th, 2009 |
| Replies: 1 Views: 326 The function is expecting an int[] (array/pointer) type and you pass an int, instead you should write the function as:
void bookInfo(char[14],char[51],char[31],char[31],char[11],int,double,double);... |
Forum: C++ Apr 11th, 2009 |
| Replies: 5 Views: 266 outputFile<<"Name: "<<Pname<<" "<<outputFile<<"Date:"<<TDate<<endl;
You output what outputFile returns. This line should be outputFile<<"Name: "<<Pname<<" "<<"Date:"<<TDate<<endl; |
Forum: C++ Apr 10th, 2009 |
| Replies: 6 Views: 313 I'm guessing it's because of the getline() function. When I replace the
if(AWUTD=='y'||AWUTD=='Y')
{
cout<<"Please Specify:"<<endl;
getline (cin, AWUTDspecification);
}
with |
Forum: C++ Dec 19th, 2008 |
| Replies: 25 Views: 1,535 Please use code tags. Otherwise it'll be hard for us to tell you on which lines your mistakes are. |
Forum: C++ Dec 18th, 2008 |
| Replies: 6 Views: 606 It doesn't matter that 'i' doesn't exist when main() ends and the thread is using it, simply because when main() ends the whole program shuts down, including the threads. |
Forum: C++ Dec 16th, 2008 |
| Replies: 8 Views: 482 Lines 40-41 - it's a STRING, not a float. I've never heard of a number with two decimal dots.
Also, you didn't end the 'for' loop before the input_type check.
You can see it yourself. |
Forum: C++ Dec 16th, 2008 |
| Replies: 8 Views: 482 That's because you removed this piece of code from your code:
else if(s[x]=='.')
{
if(!DotReached) DotReached= true;
else
{
input_type=IS_FLOAT;
cout<<"ITs a Float"; |
Forum: C++ Dec 16th, 2008 |
| Replies: 8 Views: 482 You have a few errors:
Firstly, the if(input_value==0)..... should be OUTSIDE the 'for' loop, because you want to check what kind of number the input is after you know it isn't a string nor a char.... |
Forum: C++ Dec 16th, 2008 |
| Replies: 8 Views: 482 for(x=0;x<s.length();x++)
{
if((s[x]>'9' || s[x]<'0') && s[x]!='.')
{
input_type=IS_STRING; break;
cout<<" Its an integer ";
}
else if(s[x]=='.')
{ |
Forum: C++ Dec 16th, 2008 |
| Replies: 6 Views: 1,241 Why should a constructor fail?
When you declare a constructor, all the instances of the class will have to use it, or variations of it (if you declare some). |
Forum: C++ Dec 15th, 2008 |
| Replies: 4 Views: 856 I think it would be much smarter to use the built-in function from <algorithm> header file -- random_shuffle():
Run a loop and insert to the array all the numbers between 1 and 10,000, then call... |
Forum: C++ Dec 14th, 2008 |
| Replies: 4 Views: 605 So, you actually want to round up when (the number) mod 1000 is equal or greater than 500, and down if (the number) mod 1000 is less than 500.
An example to how you could write it:
... |
Forum: C++ Dec 11th, 2008 |
| Replies: 11 Views: 797 #include<iostream>
#include<string>
using namespace std;
#define IS_STRING 1
#define IS_CHARACTER 2
#define IS_INTEGER 3
#define IS_FLOAT 4 |
Forum: C++ Dec 11th, 2008 |
| Replies: 11 Views: 797 Input to a string, then call a function to check whether it the input string has only digits (and '.', '+' and '-' as first only). If it really has only digits, it's a number. If it has a dot, it's a... |