CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

askwords function

New version - Effective with franca.h version 2001, there are two versions of the askwords function. The plain character array version and the string version. The string version requires inclusion of either one of the files below:

#include <cstring.h> - borland compilers (version 5)
#include <string> - Microsoft Visual C++ versions 5 or 6

In case none of the above are available, limited support for strings is provided by

#include "francastring.h"

Original askwords function

This function is similar to the ask function; However, ask can only be used to input numbers. Askwords, can be used to input a text.

askwords( inputstring, maxsize, message );

where:

  • inputstring: a character array where you want the input to be placed;
  • maxsize - an integer limiting the maximum size of the input string;
  • message: a character array that will be displayed in the input box for the user.

example:

askwords(first_name,20,"Enter your first name:");

String version of askwords

This function works exactly like the ask function and returns a string as a result. This function requires support for string objects as mentioned above.

example:

string name;
name=askwords("What is your name?");