C++ Programming

posted by .

What is the output of the following C++ code?

p = list;

while (p!=NULL)
cout << p->info << " ";
p = p->link;
cout << endl;

  • C++ Programming -

    That's code to walk through a linked list. I can't say the exact output because I can't see what the variable "list" is.

    Also, there are missing braces after the while statement. If the program is run without braces, and list is not null, the iteration will infinitely loop and print the first element over and over.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. C++

    #include <iostream.h> #include <stdlib.h> int main ( ) { int choice; cout << "Computer Repair" << endl; cout << "\n Does your ailing computer beeps multiable times at startup?
  2. C++

    #include <iostream.h> #include <stdlib.h> int main ( ) { int choice; cout << "Computer Repair" << endl; cout << "\n Does your ailing computer beeps multiable times at startup?
  3. C++ Programming

    Can any1 please fix this c++ source problem /*Circle Are program Calculates the area of a circle using the formula A=pi * r * r Sonny Hinh, 1/23/08 #include <iostream.h> int main() { cout << "-Calculate the area of a circle-" …
  4. C++ Programming

    I NEED HELP WITH MY CODE!!! it won't compile right The formula for finding the force of gravity between two objects is Force = grav * (mass1 * mass2) / (radius * radius), where Force = the force of gravity between the two objects, …
  5. C++ Programming

    #include <iostream.h> #include <stdlib.h> #include <math.h> int main ( ) { double noe, nod, dc1, dc2, dc3, dc4, t; cout << "Enter number of eggs: "; cin >> noe; nod = noe / 12; dc1 = .50 / 12; dc2 = .45 …
  6. C++ Programming

    #include <iostream.h> #include <stdlib.h> #include <math.h> int main ( ) { double noe, nod, dc1, dc2, dc3, dc4, t; cout << "Enter number of eggs: "; cin >> noe; nod = noe / 12; dc1 = .50 / 12; dc2 = .45 …
  7. C++ Programming

    I have to redo programming exercise 5 of chapter 9 using dynamic arrays. but I have the information but I don't know how to use it in a dynamic arrays please help. //Chapter 9: Programming Exercise 5 #include <iostream> #include …
  8. C++ if else problem, please look

    It compiles but it doesn't work. can you tell me what i did wrong?
  9. C++

    Would you check and correct my error please! ******************************* #include<iostream.h> #include<string.h> #include<bitset> viod Binary_to_Decimal(); int main(int argv,char argc) { while(1<2) { int m_choise; …
  10. C++

    I am trying to create a program that displays shipping charges for two region codes. The region code has to have exactly 3 characters (the letter A or B followed by two numbers). Display a message if invalid region code is entered. …

More Similar Questions