Exercise 9 1 2, I need help with this exercise and also can you show the output
ID: 3845071 • Letter: E
Question
Exercise 9 1 2, I need help with this exercise and also can you show the output for better understanding the step of the program.
Write a program that lets the user enter any number of lines of text, one at the time. In this effect, this creates a primitive editor that permitstext entry but not editing of a line of text after its been entered. Set up a loop that doesnt terminate until the user press enter without typing any text (a zero-lenngth string).
Alternatively, you can recognize a special code ( for example, @@@) to terminate the session. You can then use strcmp ("string compare") function to detect this string. You may recall that what this function does is to compare two C-strings and return 0 if they have the same contents.
if (strcmp(input_line, "@@@) == 0) {
break;
}
Remember to print a short prompt before each line of the text, such as the following:
Enter (@@@ to exit) >>
Explanation / Answer
#include<iostream.h>
int i, j;
for(i=0; i<100; i++){
for(j=0; j<100-i; j++){
if(carArray[i]!=NULL && carArray[j]!= NULL && carArray[j+1]!=NULL)
{
if(strcmp(carArray[i]->make, carArray[j+1]->make) == 0)
{
}
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.