123456789101112131415161718192021222324252627282930
#include <iostream> #include <string> using namespace std; int main() { int numberOfNumbers = 0; string numbers[1000]; string names[1000]; void printPhoneNumbers() { for(int i=0;i<=numberOfNumbers;i+i) { //cout << names[i]; } } void enterNumber(string numb, string name) { numbers[numberOfNumbers] = numb; names[numberOfNumbers] = name; numberOfNumbers += 1; } return 0; }
1234567
/home/zargy/Documents/Coding/Learning C++/LearnC++2/main.cpp||In function ‘int main()’:| /home/zargy/Documents/Coding/Learning C++/LearnC++2/main.cpp|13|error: a function-definition is not allowed here before ‘{’ token| /home/zargy/Documents/Coding/Learning C++/LearnC++2/main.cpp|8|warning: unused variable ‘numberOfNumbers’ [-Wunused-variable]| /home/zargy/Documents/Coding/Learning C++/LearnC++2/main.cpp|9|warning: unused variable ‘numbers’ [-Wunused-variable]| /home/zargy/Documents/Coding/Learning C++/LearnC++2/main.cpp|10|warning: unused variable ‘names’ [-Wunused-variable]| /home/zargy/Documents/Coding/Learning C++/LearnC++2/main.cpp|29|error: expected ‘}’ at end of input| ||=== Build finished: 2 errors, 3 warnings ===|
123456789101112131415161718192021222324252627282930313233
#include <iostream> #include <string> using namespace std; void printPhoneNumbers() { for(int i=0;i<=numberOfNumbers;i+i) { //cout << names[i]; } } void enterNumber(string numb, string name) { numbers[numberOfNumbers] = numb; names[numberOfNumbers] = name; numberOfNumbers += 1; } int main() { int numberOfNumbers = 0; string numbers[1000]; string names[1000]; printPhoneNumbers(); for (int i = 0; i < 1000 ; i++) enterNumber(numbers, names); return 0; }
void printPhoneNumbers()
void printPhoneNumbers(string* numbers, int size)
printPhoneNumbers(numbers, numberOfNUmbers);