My original question stated:

1. Write a function named "digits" that takes an integer argument in the range from 1 to 9 , inclusive, and prints the English name for that integer on the computer screen. No newline character should be sent to the screen following the digit name. The function should not return a value. The cursor should remain on the same line as the name that has been printed. If the argument is not in the required range, then the function should print "digit error" without the quotation marks but followed by the newline character. Thus, for example, the statement digit_name(7); should print seven on the screen; the statement digit_name(0); should print digit error on the screen and place the cursor at the beginning of the next line.


I seen this post:
http://www.daniweb.com/forums/thread162867.html

but not sure why i was asked to do so if its not possible?

#include <cstdio>
#include <cstdlib>
#include <iostream>

using namespace std;


void digits(void)
{
    int i;
	int nvalue;
	cout << "Enter a Number 1 thru 9: ";


    for(i=0; i<10; i++)
    {

    cin >> nvalue;

	switch(nvalue)
        {
            case 1:
            cout << "one";
            break;

            case 2:
            cout << "two";
            break;

            case 3:
            cout << "three";
            break;

            case 4:
            cout << "four";
            break;

            case 5:
            cout << "five";
            break;

            case 6:
            cout << "six";
            break;

            case 7:
            cout << "seven";
            break;

            case 8:
            cout << "eight";
            break;

            case 9:
            cout << "nine";
            break;

            default:

            cout << "digit error\n";
        }
    }
    return;
}



int main(int nNumberofArgs, char* pszArgs[])

{
    digits();

    system("pause");
    return 0;
}

This is a different matter entirely. The question you linked to was specifically about not printing a line break after hitting the Enter/Return key. Your requirement is merely not to print a newline character, which you're already doing.

Thanks Narue I've been having troulbe breaking down the questions as I read I start trying to plan an attack on the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.