[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 763 KB, 1024x768, Koala.jpg [View same] [iqdb] [saucenao] [google]
4825278 No.4825278 [Reply] [Original]

anyone here know how to code in c++ working on this assignment and have no clue how to do it, tried all day yesterday but getting no where, i hear a bunch of good coders are on here lol

>> No.4825284

Your panda has piqued my interest.

>> No.4825283

while(1)
cout << "Your a fagit";

>> No.4825289

>>>/g/

I must warn you though, it's a complete shithole.

>> No.4825295

post code or a link to your thread on /g/

>> No.4825306

>>4825278
post code here faggot and ill halp

>> No.4825307
File: 760 KB, 1024x768, Penguins.jpg [View same] [iqdb] [saucenao] [google]
4825307

well here is what the input should do and i cant set up the counters


Given a file of text, assume that
a "word" is 1 or more consecutive, non-whitespace characters
a "sentence" is a series of words terminated by either a period, exclamation point, or question mark
Design a C++ program (using functions/passing parameters) that will

interactively prompt for and read the name of an input file
interactively prompt for and read a string to search for
open the input file (using an input filestream variable) and with one pass through the file
count the number of "words" in the file
for each word, make sure all letters, except the first, are lower case - leave the first character unchanged
count the number of "sentences" in the file
count the number of letters in the file (A-Z,a-z)
count the number of consonants in the file (consonants are letters that are not vowels - the vowels are: a, e, i, o, u, A, E, I, O, and U)
count the number of nonwhitespace characters in the file that are NOT letters
count the number of times the search string is found in the file (must be an exact match) - search for matches AFTER upper case letters have been coverted to lower case

all my counters end up being wrong, i know how to open the input file and all that, i just need to call up the counters :/

>> No.4825310
File: 58 KB, 316x400, vash_stampede.jpg [View same] [iqdb] [saucenao] [google]
4825310

>>4825278
Sure thing, Vash.

>> No.4825313

thanks in advance for any assistance guys i really appreciate it

>> No.4825316

#include <iostream>
using namespace std;

long int main()
{

while (1)
{
cout << "I'm a Nigger who should read his C++ book!" << endl;
}

return 1337;
}

>> No.4825331

Seems to be a pretty standard exercise.
Listen to >>4825316

>> No.4825334

>Went to /g/ to look for programming thread
>Everyone on it is apeshit arguing about C vs. C++ vs. Java vs. C#
>People getting so mad over bullshit
>Idontlikeitthere.jpg
>>25855683

>> No.4825349

Dear god, OP. Are you like twelve?
Christ. You are the reason people think CS majors are dumb.

>> No.4826238

>>4825307
I recommend: openning the file, do one count, close it.
Open the file again, do another count, close it, etc.
This prevents your counts from conflicting, and allow you to separately debug all functions.

#include <fstream>
#include <iostream>
using namespace std;

int main(){
freopen("file.txt","r",stdin);
cout << countwords() << endl;
fclose(stdin);

freopen("file.txt","r",stdin);
cout << countletters() << endl;
fclose(stdin);
//etc

}

>> No.4826320

>>4825349
>implying cs major aren't idiots

>> No.4826360

#include <iostream>
using std::cin;
using std::cout;
using std::endl;
#include <fstream>
using std::fstream
#include <string>
using std::string;

void main(){
cout<<"Yo faggot, type the name of the file already"<<endl;
string file,word;
cin>>file;
cout<<"Yo faggot, type the name of the safety word"<<endl;
cin>>word;
fstream DaFILE(file,"r");
if(!DaFILE){
while(1) cout<<"OP is a FAGGOT!\n\a\a\a";
}
int* Array = new int[HOW_MANY_THINGS_IM_COUNTING]

while(!DaFILE.EOF()){
string line;
DaFILE.getline(line,'.')
if(line.compare("")!=0) Array[count_lines]++;
else continue;
line=typeSet_line(line,Array);
count_words(line,Array);
count_each_letter(line,Array);
count_word_match(word,line,Array);
count_consonants(line,Array);
count_Nonletters(line,Array);
}
PRINTOUTFINDINGS(ARRAY);
return;
}