Thread: Test For Librarys

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    14

    Test For Librarys

    all you fresh programmers i have something that will challenge you.
    I will reveal the answer by tomarrow if you cant figure it out.ONLY FOR NEW PROGRAMMERS.


    lets assume tat we dont have all the functions that exist in <string.h> and <ctype.h>. create a small library that will take care of some of these tasks. call the class myString.h. Your class should have the following functions. you may not use any of the C++ functions like toUpper, toLower, isUpper, isLower, etc.

    myToUpper: this function will take a char from main and convert it into an upper case letter. this function will then return the new char to main. before you call this function from the driver you should make sure that what ws entered was an alpha character. (use the ASCII chart for reference)

    myLength: this function will take a char array from main and return the integer number of characters that are in the array.

    myStrcpy: this function will take two char arrays and arguements and copy the contents of the second into the first. you may have this function call your length function if you need to.

    stringEmpty: this function will essentially clear out any char array. it will take the char array and its size from main and assign all empty spaces to it, with a null char at the end. this will be of void return type.

    you should creat a driver that will display the use of this library.

    good luck!

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    This will get you started.....
    Code:
    #include<stdio.h>
    #include<iostream.h>
    #include<fstream>
    #include<windows.h>
    #include<sys/largedoseofsalts.h>
    void main()
    {
         int i=0;
         l1: cout << "Do your own fomework. "<<endl;
         l2: printf("Bazy lastards get nowhere in life\n");
         if(++i%2==0)goto l2;
         goto l1;
    }
    Editted for content by Kermi3
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    hahahaha agreed, Stoned_Coder.

    ray, don't make other people do your homework, and if you do, at least have the balls to comeout and say "do my homework for me." At least then you'd get some respect.

  4. #4
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Originally posted by Stoned_Coder
    This will get you started.....
    Code:
    #include<stdio.h>
    #include<iostream.h>
    #include<fstream>
    #include<windows.h>
    #include<sys/largedoseofsalts.h>
    void main()
    {
         int i=0;
         l1: cout << "Do your own fomework. "<<endl;
         l2: printf("Bazy lastards get nowhere in life\n");
         if(++i%2==0)goto l2;
         goto l1;
    }
    Are trying to confuse him or something with that code?

  5. #5
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    sorry forgot an include....
    Code:
    #include<complete........take.h>
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  6. #6
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    might wanna include:
    #include <retardfunctions.h>

  7. #7
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    hmmm, I don't think I have those headers

  8. #8
    Bios Raider biosninja's Avatar
    Join Date
    Jul 2002
    Location
    South Africa
    Posts
    765
    The trouble some people wil got through just to get some homework done


    Code:
    #include <uselesspost.h>
    The knack of flying is learning to throw yourself at the ground and miss.

  9. #9
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    Enough point is made. Ray make sure you read the forum guidleines and if you have any questions about it, or more specific problems with the work please feel free to post them.


    Though if I were you I would avoid trying to pass it off as a "chellenge" the programmers on these boards aren't stupid, quite far from it, (cept for gov maybe jk).


    If by any chance this isn't a homework problem I appologize, though it does look that way.

    Oh and future note -

    The overdone, and repetitive bashing of posts like this isn't a good thing in my opinion.
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  10. #10
    cereal killer dP munky's Avatar
    Join Date
    Nov 2002
    Posts
    655
    Originally posted by kermi3
    The overdone, and repetitive bashing of posts like this isn't a good thing in my opinion.
    ..i agree, although i think it is sometimes needed to get the point across that you should do your own work. although we already did make that point so uh, yeah, moving on...
    guns dont kill people, abortion clinics kill people.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Integer Emulation
    By Elysia in forum C++ Programming
    Replies: 31
    Last Post: 03-18-2008, 01:03 PM
  2. undefined reference
    By 3saul in forum Linux Programming
    Replies: 12
    Last Post: 08-23-2006, 05:28 PM
  3. C++ Operator Overloading help
    By Bartosz in forum C++ Programming
    Replies: 2
    Last Post: 08-17-2005, 12:55 PM
  4. MSVC Template Constructor/Assignment Errors
    By LuckY in forum Windows Programming
    Replies: 3
    Last Post: 07-22-2005, 02:57 PM
  5. Question About Linker Errors In Dev-C++
    By ShadowMetis in forum C++ Programming
    Replies: 9
    Last Post: 08-18-2004, 08:42 PM