I am not sure if this is the kind of problems you talk about but i need to ask someone who can help. I am very new to c++ and i turned in an assignment in class the other day and i got points taken off for no class/header file. When i asked a tutor at school the said i do not need a header file. So here is the code, i was wondering if some one can tell me what would be in the header file and how would it look. Our teacher is a bad teacher and doesn't explain things well so i am having a hard time.
Thanks
//William Norman
//Project 1
//CS 2310
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
using namespace std;
const int maximum = 100;
int main()
{
string total[maximum];
string input;
int n;
int number_in;
int number_count = 0;
int length;
ofstream output;
output.open ("L:\\project1.txt");
cout<<"Enter Number of Strings: ";
cin>>number_in;
cout<<"Enter String: ";
for (n=0; n<number_in; n++)
{
cin>>input;
total[n] = input;
length = input.length();
for (int n=0; n<length; n++)
{
if(input[n] == 'a' || input[n] == 'A'
|| input[n] == 'e' || input[n] == 'E'
|| input[n] == 'i' || input[n] == 'I'
|| input[n] == 'o' || input[n] == 'O'
|| input[n] == 'u' || input[n] == 'U')
{
number_count++;
}
else{}
}
}
output<<"The String: ";
for (int v=0; v<number_in; v++)
output<<total[v]<<" ";
output<<"has "<< number_count<<" vowels";
output<<endl;
output<<"The Words in the String are: ";
output<<endl;
for (n=0; n<number_in; n++)
{
output<<total[n];
output<<endl;
}
return 0;
}


Sign In
Create Account

Guest_norman_069_*
Back to top










