>well it needs to be made in a combination of C and c++ really
Why? Unless you're familiar with C, the only possible result of trying to mix the two is a lot of compilation and run-time errors.
>void main()
This is neither C nor C++. main always returns int.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>and my professor told us to use void main() instead of int main()
That explains so much it's not even funny. Your professor doesn't know nearly as much as he probably thinks he does. In my opinion, one should learn the language before trying to teach it.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>so any suggestions on my program?
#include <cstdlib>
#include <iostream>
void pig_latin ( const char *line );
int main()
{
char line[1024];
cout<<"Enter a sentence: ";
if ( !cin.getline ( line, sizeof line ) ) {
cerr<<"Invalid input"<<endl;
return EXIT_FAILURE;
}
pig_latin ( line );
return EXIT_SUCCESS;
}
void pig_latin ( const char *line )
{
// Walk across the string until you hit '\0'
// Save all characters up to a vowel
// Print all characters up to a space
// Print the saved characters
// Print "ay"
}
That's a good start for a simple pig latin program.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401