Hey guys, I am writing program to count the length of the string. Here is my code.
#include<iostream>
using namespace std;
int stringLength(char string[]) {
int i;
for(i = 0; string[i] != NULL; i++);
return i;
}
int numSpace(char string[]) {
int c = 0;
for(int i =0; string[i] != NULL; i++) {
if( string[i] == ' ')
c++;
}
return c;
}
int main(int argc, char** argv) {
char string[] = " ";
char dummy;
cout << stringLength(string) << endl;
cout << numSpace(string) << endl;
cin >> dummy;
return 0;
}
Probability is a measure or estimation of how likely it is that something will happen or that a statement is true.
The higher the degree of
probability, the more likely the event is to happen, or, in a longer series of samples,
the greater the number of times such event is expected to happen.
When I put this paragraph in char string[] = " "; the compiler ( I am using MS Visual C++ 2010) puts all the words in one line.
My question is how to span several lines to make the code easier to read ?
Appreciate for your time !
littlepotato
Edited by dargueta, 03 March 2013 - 08:25 PM.
















