I am in a C++ class and find myself struggling with creating functions that use letters. I have to write out two sentences to the screen. But the assignment is create one function for each letter, space, carriage, return, and punctuation mark. Each word output is controlled by a function (calls each letter, etc function). Each sentence output is controlled by a function (calls each word function). I have read my text book over and over. I have even bought the book C++ for dummies. We have not studied strings or arrays. I know that if I wanted to type out the whole sentence I would have to have code like the following
#include <iostream>

using std::cout;
using std::endl;

//prototype
void Sentence (void);

void main (){
//call
Sentence ();
}

//definition

void Sentence (void){
cout << I need help << endl;
}

So my question is how do I do this a letter at a time and bring it all together using functions to create letters then words and then sentence :?: Any help will be appreciated :confused:

From the sounds of it, you'd have a bunch of functions like this:

void Print_a()
{
    printf("a");
}

and then to make the word 'apple' you might have:

void Print_apple()
{
    Print_a();
    Print_p();
    Print_p();
    Print_l();
    Print_e();
}

and so on.

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.