Thread: Are these headers standard?

  1. #1
    Evil Member
    Join Date
    Jan 2002

    Exclamation Are these headers standard?

    Hi guys. This is a program I have to write for a C++ class.

    My problem: My teacher says it won't c/l on her computer. She says the #include statements for conio.h and cctype are throwing errors. So my question is this, are cctype and conio.h standard headers?

    Any ideas? I can c/l it fine, so I can't really tell you what the error is.

    Module 3 Program - car.cpp
    last edit: 1 February 2002, 1411 EST
    #include <iostream>  //for cin, cout
    #include <cctype>    //for isalpha(), isspace(), and isdigit()
    #include <string>    //for atoi()
    #include <conio.h>   //for clrscr()
    #include "apclass/apstring.cpp"  //for apstring objects
       bool plate_checks_out(char*);
       void plate_to_code(char*);
       using namespace std;
       int main () {          
          apstring make, model;
          char plate[8];
          cout << "Enter Make         - ";
          cin >> make;
          cout << "\nEnter Model        - ";
          cin >> model;
          cin.ignore();   //If only cleaning the gutters was this easy   
          cout << "\nEnter Plate Number - ";
          cin.getline(plate, 8);
          while (!plate_checks_out(plate)) {   //GIGO += a_little_bit
             cout << "Hmm, something seems to be wrong with that plate number. "
                "\nRemember, the format is: Three letters followed by three numbers. "
                "\n\nNow exiting program, have a nice day.";
          cout << "Make    = " << make  << '\n';
          cout << "Model   = " << model << '\n';
          cout << plate << " = ";
          return 0;
       bool plate_checks_out(char* plate) {
          if (isalpha((int) plate[0]) && isalpha((int) plate[1]) && 
             isalpha((int) plate[2]) && isspace((int) plate[3]) &&
             isdigit((int) plate[4]) && isdigit((int) plate[5]) && 
             isdigit((int) plate[6]) ){
             return 1;
          return 0;
       void plate_to_code(char* plate) {
          int numberPart = atoi((const char*)&plate[4]) + toupper((int)plate[0]) + toupper((int)plate[1]) + toupper((int)plate[2]);
          cout << char((numberPart % 26) + 65);
          cout << numberPart;

  2. #2
    Registered User
    Join Date
    Dec 2001
    I believe that conio.h is non standard, and the clrsrc function is different any everysystem, but it really isint necessary in your program so just cut it out.
    You can use ctype.h instead of cctype

  3. #3
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    conio.h is compiler specific so it varies from borland to ms to dev etc, but i believe it is shipped with most major compilers.

    and the correct header is ctype.h which i believe is a standard library

  4. #4
    Evil Member
    Join Date
    Jan 2002
    I thought the standard libs didn't have the .h ending?

    djgpp finds cctype just fine

    thanks for your help though.

  5. #5
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    i believe omitting the .h is a new practice, im sure someone will on here will be able to tell you a lot more about it than i can.
    Monday - what a way to spend a seventh of your life

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    cctype is indeed standard, conio.h is not and should be avoided if at all possible. Old C++ had the .h extension for headers but new C++ removes them.

    If your teacher is having problems with cctype then I would assume he/she has an old or nonstandard compiler. Try using ctype.h and lose conio.

    My best code is written with the delete key.

  7. #7
    Registered User
    Join Date
    Jan 2002
    If you use headers with out the .h then you are doing it in a c++ fashion. If that is the case then you have to specify what name space you are using (normally std). Either that or prefix an std:: before each function you use from that libary (i think thats the standerd way of doing it).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Which of the C 'Standard Library headers' are worth rembering?
    By Ravens'sWrath in forum C Programming
    Replies: 24
    Last Post: 05-17-2007, 02:12 AM
  2. Question array loop
    By MILLWALLL in forum C++ Programming
    Replies: 24
    Last Post: 03-26-2007, 01:54 AM
  3. Standard for header file naming/capitalization?
    By skorman00 in forum C Programming
    Replies: 4
    Last Post: 04-21-2006, 02:38 AM
  4. iostream or iostream.h?
    By serruya in forum C++ Programming
    Replies: 15
    Last Post: 05-05-2003, 07:41 AM
  5. standard language, standard compiler?
    By doubleanti in forum A Brief History of
    Replies: 8
    Last Post: 09-03-2001, 04:21 AM