what sort of algorithm would this require? I'm not sure how to even look it up Posted: 29 Jun 2021 01:15 AM PDT |
Are the intents of data structures and design patterns both to move towards types or something in programming lnaguages? Posted: 29 Jun 2021 06:09 AM PDT Data structures are often taught together with algorithms. Is the intent of data structures to wrap algorithms and move from algorithms a step closer towards types in programming languages? I heard that the intent of design patterns (such as those introduced in Gang of Four's book) is to make up the lack of support for something in programming languages. Is the intent of design patterns also to move a step closer towards types in programming languages, from something by wrapping that something? Thanks. submitted by /u/timlee126 [link] [comments] |
Online Algorithm Assignment Help | Algorithm Solutions Posted: 29 Jun 2021 05:25 AM PDT |
Best Java Homework Help Online | Do My Java Homework for Me Posted: 29 Jun 2021 05:23 AM PDT |
Database Management System Assignment Help by Professionals Posted: 29 Jun 2021 05:24 AM PDT |
Why doesn't the output match the expected one when computing the standard deviation in CPP? Posted: 23 Jun 2021 07:52 PM PDT description and sample: https://imgur.com/a/Vsc9Lp7 here only code for girls.txt #include<iostream> #include<fstream> #include<cctype> #include<iomanip> #include<cmath> #include<sstream> using namespace std; string tolowercase(string s){ for(int i=0;i<s.length();i++){ s[i]=tolower(s[i]); } return s; } int isInArray(string arr[],string target){ for(int i=0;i<100;i++){ stringstream ss; string name; ss<<arr[i]; ss>>name; if(tolowercase(name)==tolowercase(target)){ return i+1; } } return -1; } string namings(string s){ stringstream ss; ss<<s; string str,str2; ss>>str>>str2; return str2; } int main(){ string girls[100]; fstream p("girls.txt"); int i=0; while(p>>girls[i]){ string temp; p>>temp; girls[i]+=" "+temp; i++; } p.close(); while(1){ cout<<"(If you don't want to search name, please input exit!)\n"; cout<<"Enter name: "; string name; cin>>name; if(name=="exit"){ break; } cout<<endl; int index=isInArray(girls,name); if(index==-1){ cout<<name<<" is not ranked among the top 100 girl names.\n\n"; }else{ cout<<name<<" is ranked "<<index<<" in popularity among girls with "<<namings(girls[index-1])<<" namings.\n"; //here start computing standard deviation double u; double sum=0; for(int i=0;i<10;i++){ sum+=stod(namings(girls[index-1+i+1])); } u=sum/10; sum=0; for(int i=0;i<10;i++){ sum+=(stod(namings(girls[index-1+i+1]))-u)*(stod(namings(girls[index-1+i+1]))-u); } double sd=sqrt(sum/10); cout<<"Standard Deviation of the 10 list below this rank : "<<sd<<endl; cout<<endl; } } return 0; } girls.txt Mary 3196385 Patricia 1558407 Jennifer 1468377 Linda 1448303 Elizabeth 1420377 Barbara 1397635 Susan 1103569 Jessica 1046322 Sarah 991910 Karen 986057 Nancy 966867 Lisa 965015 Betty 924629 Margaret 918541 Sandra 873509 Ashley 849297 Kimberly 839796 Emily 830999 Donna 822330 Michelle 812335 Dorothy 811392 Carol 806170 Amanda 773199 Melissa 753994 Deborah 740019 Stephanie 738523 Rebecca 729630 Sharon 720826 Laura 718006 Cynthia 705717 Kathleen 686217 Amy 681397 Shirley 663452 Angela 658968 Helen 618563 Anna 618367 Brenda 606291 Pamela 592696 Nicole 589434 Emma 580610 Samantha 578986 Katherine 571574 Christine 561161 Debra 548280 Rachel 546153 Catherine 542748 Carolyn 540963 Janet 539224 Ruth 538629 Maria 529342 Heather 524166 Diane 515183 Virginia 515088 Julie 506594 Joyce 499340 Victoria 485786 Olivia 481364 Kelly 471621 Christina 471106 Lauren 470902 Joan 467459 Evelyn 461952 Judith 449805 Megan 437647 Cheryl 436882 Andrea 436126 Hannah 431117 Martha 426247 Jacqueline 420505 Frances 414289 Gloria 408565 Ann 407374 Teresa 404253 Kathryn 402613 Sara 400884 Janice 399546 Jean 399416 Alice 396362 Madison 393297 Doris 383158 Tyler 381738 Julia 380836 Judy 377815 Grace 377678 Denise 371269 Amber 370577 Marilyn 369781 Beverly 369669 Danielle 368485 Billy 367426 Sophia 364383 Marie 361371 Diana 359617 Brittany 358850 Natalie 356379 Isabella 354245 Charlotte 347772 Rose 344656 Alexis 340587 Kayla 340511 submitted by /u/hwpcspr [link] [comments] |
No comments:
Post a Comment