No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
I'm a little lost with C++ so I could really use your help with this one! I googled it but nothing does what I want to do! So here is my problem... Let's say I have a file like this: A 10 20 30 40 B 25 13 100 99 … |
|
[CODE] #include <iostream> #include <string> #include <cctype> #include <iomanip> #define N 36 using namespace std; string EraseWhiteSpaces(string &str_nospaces) { int i; for (int i=0;i<str_nospaces.length();i++) { if (str_nospaces[i]==' '||(str_nospaces[i]=='\t')) { str_nospaces.erase(i,1); i--; } } return str_nospaces; } string ConvertToLowerCase(string &str_lowercase) { int i; for (i=0;i<str_lowercase.length();i++) str_lowercase[i]=tolower(str_lowercase[i]); return str_lowercase; } void SortedFrequences(int … |
|
Hi everyone! I am trying to understand tolower function... I don't get the locale variable to be honest and I would also like to know what I have to do so as to save the lower case string to another string and not just print it! That's my code... [CODE]#include … |
|
Hello guys! I have to create a program that prints the last 10 lines of a text or all of it if the number of the lines is <=10. The input will be a file that is unknown to me. This is what I've done so far. [CODE] #include <iostream> … |
|
[CODE]#include <stdio.h> #DEFINE suntetagmenes 3 double eswterikoginomeno(double dianusmata[][suntetagmenes]) { int j; double eswteriko=0; for (j=0;j<suntetagmenes;j++) { eswteriko+=dianusmata[0][j]*dianusmata[1][j]; } return(eswteriko); } double e3wterikoginomeno(double dianusmata[][suntetagmenes], int i) { double e3wteriko; if (i==0) { e3wteriko=dianusmata[0][1]*dianusmata[1][2]-dianusmata[0][2]*dianusmata[1][1]; } else if (i==1) { e3wteriko=dianusmata[0][2]*dianusmata[1][0]-dianusmata[0][0]*dianusmata[1][2]; } else { e3wteriko=dianusmata[0][0]*dianusmata[1][1]-dianusmata[0][1]*dianusmata[1][0]; } return(e3wteriko); } int main() { char x='m'; … |
|
[CODE]#include <stdio.h> #include <string.h> #include <stdlib.h> int getNumWords(char *name) { int i,numofwords=0; for(i=0;i<strlen(name);i++) { while (name[i]==' ') { i++; //pernaei ta kena osa k an einai. akoma k an einai stin arxi k sto telos } if (((i==0)&&(name[i]!=' '))||(i>=1)&&((name[i-1]==' ')&&(name[i]!=' ')&&(name[i]!='\0'))) { //i 1i sun8iki einai gt an to i … |