Greetings,

I need help with a Simple C program.

I have to take input data such as this :

Write a C program that will process a series of "words"
entered by the user. A word (for the purpose of this
assignment) is defined as a sequence of non-white-space
characters (anything other than a space, a tab, or a
newline). The following activities should be performed
in the program, and on the data entered by the user.
Does all of this sound right? You betcha!


and be able to count how many words are in it (66) , the longest word, how many capitalized words, how many sentences, the longest sentence, and the average length of words. We havent gotten in to any type of advanced coding so anything more complex than basic while-loops probly wont be of any help :(

Any help would be fine, this is my code so far.....its not saying much though /cry

#include <iostream>

int main() {
  string word;
  int wordCount = 0;
  string line;


  cout << "Enter Your Lines:" << endl << endl;

   while (getline(cin,line))
    endl;



  return 0;
}

This is not C but C++; and if you don't know that, I am afraid you'll have a hard time convincing me that this is your code.

Well I assure you that that is my code, and I am in a basic CompSci class which covers basic C Programming. If you do not believe me this is the assignment:

Write a C program that will process a series of "words" entered by the user. A word (for the purpose of this assignment) is defined as a sequence of non-white-space characters (anything other than a space, a tab, or a newline). The following activities should be performed in the program, and on the data entered by the user:

Well I assure you that that is my code, and I am in a basic CompSci class which covers basic C++ Programming. If you do not believe me this is the assignment:

Write a C++ program that will process a series of "words" entered by the user. A word (for the purpose of this assignment) is defined as a sequence of non-white-space characters (anything other than a space, a tab, or a newline). The following activities should be performed in the program, and on the data entered by the user:

Either those corrections need to be made in your post, or you have been attending the wrong class all this time.
Oh, wait, there's one more possibility. May be the class is really basic, to the point where the teacher doesn't know what's the difference between C and C++.

i always hated it when i realized 3/4ths of the way through a semester i'd been sitting in the wrong class.

it did sort of make sense, in hindsight, as to why i thought everyone was talking moon-man talk.

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.