1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#include <iostream>
#include <iomanip>
#include <string>
#include <stdio.h>
#include <string.h>
using namespace std;
void printWordLengths(char inputa[], char inputb[], char inputc[], char inputd[], char inpute[], char inputf[]);
//int printNeighbors();
char path;
int main(){
cout << "N[eighbors] W[ords] Q[quit]\n";
cout << "Enter your choice -> ";
cin >> path;
while( path!='q' || path!='Q'){
if( path=='w' || path=='W'){
char wordt[] = "These";
char wordc[] = "classes";
char worda[] = "are";
char wordr[] = "really,";
char wordrr[] = "really";
char worde[] = "easy!";
printWordLengths(wordt, wordc, worda, wordr, wordrr, worde);
//cout << "W works";
//string words[7] = {"These","classes", "are", "really,", "really", "easy!"};
//printWordLengths(words);
}
else if(path=='n' || path=='N')
cout << "n works";
}
return 0;
}
//cout << "N[eighbors] W[ords] Q[quit]\n";
//cout << "Enter your choice -> ";
//cin >> ;
void printWordLengths(char inputa[], char inputb[], char inputc[], char inputd[], char inpute[], char inputf[]){
cout << "Word #1 is " << strlen(inputa)<< "characters.";
cout << "Word #2 is " << strlen(inputb)<< "characters.";
cout << "Word #3 is " << strlen(inputc)<< "characters.";
cout << "Word #4 is " << strlen(inputd)<< "characters.";
cout << "Word #5 is " << strlen(inpute)<< "characters.";
cout << "Word #6 is " << strlen(inputf)<< "characters.";
return;
}
//int printNeighbors();{}cin.ignore();cin.get();
//return 0;
//}
|