Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 1675
Number of posts: 4764

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Sentence Generator using arrays C++ Posted by MrHappyTh0ught on 9 Feb 2013 at 5:38 PM
I'm having trouble trying to figure out this program could anyone help?
Here's the code I've written so far

#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>


using namespace std;
void sentenceGenerator (char noun[], char verb[], char subject[])


int main()
{

const int MAX_SENTENCE = 5 ;
string sentence[MAX_SENTENCE] ;

char noun[5] = {"Dog", "He", "She", "Bill", "Jane", } ;
char verb[5] = {"Hops", "Runs", "Hugs", "Jumps", "Skips", } ;
char subject[5] = {"Pond", "Road", "Bill" ,"Jane", "Spike", } ;

srand(static_cast<unsigned int>(time(0))));
int randomChar = rand();

cout << "The sentence: \n" ;
for (int i = 0; i < sentence ; ++i)
{
cout << sentence[i] << endl ;
}

return 0;
}





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.