ok Ihave developed some code that i am having trouble with how I would I call teh text in the last functions to come into it the part labled 10 and then finally how would I incorperate the 3 parts to work on the first part of the function. the parts labled What goes here???? are where I know Iwould make them call to a greater part to conjoin them together but how would I do that?
//****************************************************************************
int getput()
{
string what goes here????;
fstream streamObject("http://www.gutenberg.org/cache/epub/1342/pg1342.txt");
fstream localFile("pap.txt");
fstream newFile("new.txt");
if(streamObject.fail())
cout << "file failed to load." << endl;
else
cout << "file load was successful." << endl;
if(localFile.fail())
cout << "file2 failed to load." << endl;
else
cout << "file load was successful." << endl;
while(!streamObject.eof())
{
streamObject.put(localFile.get());
}
streamObject.close();
char single = localFile.get();
while(!localFile.eof())
{
what goes here???? += single;
single = localFile.get();
}
localFile << newFile;
localFile.close();
asciistring(what goes here????);
doubledelete(what goes here????);
numberwordsinstring(what goes here????);
return 0;
}
//****************************************************************************
int asciistring() {
char String[100];
int Sum,Index;
Sum=0; //Sum is initially zero
printf("Enter the string:\n");
gets(String); //Accept String from User
for(Index=0;Index<strlen(String);Index++)
{
Sum+=(String[Index]); //Adds (the ASCII values of) the String characters.
}
printf("The sum is %d\n",Sum); //Printing it as %d gives the equivalent ASCII value.
return 0;
}
//****************************************************************************
int doubledelete(){
cout << forceSingleSpaces1("sentence1. sentence2. end. ") << endl;
return EXIT_SUCCESS;
}
//****************************************************************************
int numberwordsinstring()
{
int i, numspaces;
char nextChar;
string msg;
numspaces=1;
cout << "Type in a string\n";
getline(cin, msg);
// checks each character in the string
for (i=0; i<int(msg.length()); i++)
{
nextChar = msg.at(i); // gets a character
if (isspace(msg[i]))
numspaces++;
}
cout << "\nThere are " << numspaces << " words in this string.";
cin.ignore();
return 0;
}