[Dev-C++] Please help me...why doesn't the code compile?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Jose S. <dyo...@ho...> - 2001-08-10 23:56:14
|
Please help me anyone... :-)
There are actually three files here; main.cpp, module1.cpp, and main.cpp.
I'm trying to separate the function prototypes into a header file, and put
the function body in a source file, since the function is generic enough to
be used in many programs, and I want to make it into a module, but it
doesn't compile... :-(
THANK YOU in advance!!!
//////////////////////////////////////////////////////
// Module : main.cpp
//
// Purpose : Shows the usage of modular functions
//////////////////////////////////////////////////////
#include <iostream.h>
#include "module1.h"
void main()
{
cout << "This is a test\n";
cout << UCase("This is a test of UCase\n");
cout << LCase("This is a test of LCase\n");
}
//////////////////////////////////////////////////////
// Module : module1.cpp
//
// Purpose : Shows the usage of modular functions
//////////////////////////////////////////////////////
#include "module1.h"
//////////////////////////////////////////////////////
// UCase()
char* UCase(char *str)
{
// Convert each char in the string to uppercase
//
int len = strlen(str);
for (int i = 0; i < len; i++)
str[i] = toupper(str[i]);
return str;
}
//////////////////////////////////////////////////////
// LCase()
char* LCase(char *str)
{
// Convert each char in the string to lowercase
//
int len = strlen(str);
for (int i = 0; i < len; i++)
str[i] = tolower(str[i]);
return str;
}
//////////////////////////////////////////////////////
// Module : module1.h
//
// Purpose : Interface for module1.cpp
//////////////////////////////////////////////////////
#ifndef __MODULE1_H__
#define __MODULE1_H__
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
// Function prototypes
//
extern char* LCase(char *str);
extern char* UCase(char *str);
#endif //__MODULE1_H__
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
|