Thread: iostream.h problems

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    11

    Angry iostream.h problems

    I download the Bloodshed compiler (Dev-C++ 4.9.5.0), and it didn't come with apstring.h. I went and found it on the net, and downloaded the file into my include directory. For some reason, I get the following errors:

    Line 9: initializing non-const 'bool $' with 'ostream &(*)(ostream &)' will use a temporary
    line 217(this is in my iostream.h file): in passing argument 1 of 'istream::operator >>(bool &)'

    here is my code:

    Code:
    #include<iostream.h>
    #include<apstring.h>
    main()
    {
        apstring word;
        cout<<"Input word."<<endl;
        cin>>word>>endl;
        cout<<word<<endl;
    }
    Is there something up with my apstring.h? Or something in my code? Help is greatly appreciated.

    NOTE: This is just the code to get my damn apstring.h to work.
    I'm not here. This isn't happening

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Dont think that simply downloading aheader will allow you to add to your compiler (most headers come with a library - see here )

    I dont know what apstring is......but you would be better trying to use std::string if you can

    Code:
    #include<iostream>
    #include<string>
    
    int main()
    {
        std::string word;
        std::cout << "Input word." << std::endl;
        std::cin >> word;
        std::cout << std::endl << word << std::endl;
    }
    Also add int before main and lose the old style headers

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    11
    Thanks. Any reccomendations for a free compiler that has apstring.h? I actually have to use it, we are supposed to write a program that uses apstring in some way, unfourtuantly.
    I'm not here. This isn't happening

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by UniqueScreenNam
    Thanks. Any reccomendations for a free compiler that has apstring.h? I actually have to use it, we are supposed to write a program that uses apstring in some way, unfourtuantly.
    Afraid not, but a quick look on the web shows it to be some sort of calss written for college courses....so a quick word with your lecturer/teacher would probably help...

    I dont understand why colleges are still using classes like these? We have had a completed ISO standard in C++ for like 5 years and that brings its own library! Surely its time better spent concentrating on them rather than some custom written class. Its not as if there's any cost for reasonally std complient compilers.

    Ah well....

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    #include "apstring.h"

    needs to be in double quotes and in the same folder your program is in...apstring.h requires this for some reason, i don't think you can just add it to the include folder and #include it using < > signs.

  6. #6
    Registered User
    Join Date
    Nov 2002
    Posts
    14
    Apstring is for beginners, i like string better but whatever. Here is the ones i used from before. If your using Borland just do what you did before except put these files into your include directory. As for Visual C++ i had to #include "apstring.cpp" why? I don't know and am to lazy to find out.

  7. #7
    Registered User
    Join Date
    Sep 2002
    Posts
    11
    thanks, but i figured it out. I needed a library file, had none. Instead of figuring out how to make one, I just put the whole of apstring.h above my int main(). works fine, and at school i have apstring.h

    now i just have to figure out how to search through an apstring, find a letter the user entered, and check to see if the letter is there (in the said apstring) or not. which i cant figure out for the life of me.

    and i HAVE TO USE APSTRING
    I'm not here. This isn't happening

  8. #8
    Registered User
    Join Date
    Nov 2002
    Posts
    14
    apstring.find(letter);

  9. #9
    CS Author and Instructor
    Join Date
    Sep 2002
    Posts
    511

    Cool

    In the APCS programs in high schools, to teach some of the more chanllenging concepts of C++. The College Board created some safe - generally non-standard C++ classes that would help APCS students. Now, this will change with the fact Java will now be taught in high school. The same thing- nonstandard class will probably take place as well.
    Mr. C: Author and Instructor

  10. #10
    Registered User
    Join Date
    Sep 2002
    Posts
    11

    just one more question:

    Thanks for all of the help, I got it working.

    What I need now, because I can't find it, is how to copy something into a specific part of an apstring, depending on if it is a vowel, contanent, or digit.

    Code:
    int main()
    {
    
        apstring vowels = "aeiouAEIOU";
        apstring consts = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ";
        apstring digits = "1234567890";
        
        apstring word;
        cout<<"Input the word "<<endl;
        cin>>word;
        cout<<endl;
        
       for (int i=0; i<word.length(); i++)
        {
        apstring temp = word.substr(i,1);
        cout<<temp<<endl;
        if (vowels.find(temp)!=npos)
            {
            cout<<"Vowel"<<endl;
            }
        else if (consts.find(temp)!=npos)
            {
            cout<<"Constanent."<<endl;
            }
        else if (digits.find(temp)!=npos)
            {
            cout<<"Digit."<<endl;
            }
        else 
            {
            cout<<"Not a number or letter."<<endl;
            }
        
        }
    
    return 0;
    }
    Header files are up near the top, along with all of apstring.h

    Instead of having it say Vowel for vowels and Constanent for constanents, I would like it to copy in a V or C. What would be the syntax for that? I searched everywhere, and the only stuff I could find that remotely looks like it does it are the really complicated functions in apstring.h that I can't decifer for the life of me.
    I'm not here. This isn't happening

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. C Pointers Problems
    By mhelal in forum C Programming
    Replies: 8
    Last Post: 01-10-2007, 06:35 AM
  3. String Manipulation problems -_-
    By Astra in forum C Programming
    Replies: 5
    Last Post: 12-13-2006, 05:48 PM
  4. Rendering problems (DirectX?)
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 08-17-2006, 12:17 PM
  5. DJGPP problems
    By stormswift in forum C Programming
    Replies: 2
    Last Post: 02-26-2002, 04:35 PM