Question

C++. Did I get this right? int ted = 25; //int andy; cout << ted <<...

C++. Did I get this right?

int ted = 25;
//int andy;
cout << ted << endl; //Prints 25

cout << endl;

  
int*andy = &ted;
cout << ted << endl; //Prints 25
  
cout << endl;

cout << &ted << endl; //Prints address of ted

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>

using namespace std;

int main() {
int ted = 25;
//int andy;
cout << ted << endl; //Prints 25
  
cout << endl;
  
  
int*andy = &ted;
cout << ted << endl; //Prints 25
  
cout << endl;
  
cout << &ted << endl; //Prints address of ted
}

Add a comment
Know the answer?
Add Answer to:
C++. Did I get this right? int ted = 25; //int andy; cout << ted <<...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++. What is happening in this code? I'm having a bit of difficulty understanding some lines...

    C++. What is happening in this code? I'm having a bit of difficulty understanding some lines of code due to pointers. Please refer to the comments and correct me on what is going on in the code. Thank you. Practice code: int ted = 25; //int andy; cout << ted << endl; //Prints 25 cout << endl;    int*andy = &ted; cout << ted << endl; //Prints 25 cout << endl; cout << &ted << endl; //Prints address of ted...

  • How many Iterations will this while loop perform? int ico), j(10); cout << "i = "...

    How many Iterations will this while loop perform? int ico), j(10); cout << "i = " << i << endl; cout << "j = " << j << endl; while (i > j) { cout << "j-" « j << endl; j += 2; cout << "i = " << i << endl; } cout << "i = << i << endl; cout << "j = " << j << endl; 5 6 C 8 10 Infinite times Does the...

  • int myarray[100]; cout << "Enter number of integers : "; int n; cin >> n; cout...

    int myarray[100]; cout << "Enter number of integers : "; int n; cin >> n; cout << "Enter " << n << " integers" << endl; for (int i = 0; i < n; i++)   cin >> myarray[i]; cout << "Contents of array : "; printArray(myarray, n);

  • Computer Science C++ Program What is the output? int num =5; int* ptr = # cout...

    Computer Science C++ Program What is the output? int num =5; int* ptr = # cout << ptr << endl; cout << &ptr << endl; cout << *ptr << endl; What are the values stored in the following array? Draw a simple picture of the array with indexes and show what each element should be. int arrayExample [4] = { 5 };

  • #include <iostream> #include <climits> Using namespace std; Intmain() { Int I; Int j; Cout << “For...

    #include <iostream> #include <climits> Using namespace std; Intmain() { Int I; Int j; Cout << “For this compiler: “ << endl; Cout << “integers are: “ << sizeof(int) << “bytes” << endl; Cout << “largest integers is “ <<INT_MAX << endl; Cout << “smallest integers is “ <<INT_MIN << endl; Cout << “Input two integers values “ << endl; Cin >> i >> j; Cout << endl << “You entered the following values: “ << endl; Cout << “integer “...

  • C++ getline errors I am getting getline is undefined error messages. I would like the variables...

    C++ getline errors I am getting getline is undefined error messages. I would like the variables to remain as strings. Below is my code. #include <iostream> #include<string.h> using namespace std; int index = 0; // variable to hold how many customers are entered struct Address //Structure for the address. { int street; int city; int state; int zipcode; }; // Customer structure struct Customer { string firstNm, lastNm; Address busAddr, homeAddr; }; // Functions int displayMenu(); Customer getCustomer(); void showCustomer(Customer);...

  • Am I using the right cin statement to take in values for my array? If I...

    Am I using the right cin statement to take in values for my array? If I print them out it prints "0x61fea0" with the input 1 2 3 4 5 ///////////////////////////////// #include <iostream> using namespace std; const int ARRAY_LENGTH = 5; int main(){ int numbers[ARRAY_LENGTH]; int threshold; //@todo prompt user to enter array values cout << "Please input 5 numbers: " << endl; for(int i = 0; i < ARRAY_LENGTH; i++){ //@todo add cin statement to read in values for...

  • #include<iostream> using namespace std; double hey(int x){ if(x==2) return 1; int i=0; if (x%2==0){ while(i<=2){ cout<<(x/2)<<endl;...

    #include<iostream> using namespace std; double hey(int x){ if(x==2) return 1; int i=0; if (x%2==0){ while(i<=2){ cout<<(x/2)<<endl; i++; break; } } if (x%2==1){ while(i<=2){ i=3*x+1; cout<<i<<endl; } return 1; } } int main() { int n; cout<<"insert a number to check how many steps to reduce down to 2"<<endl; cin>>n; cout<<hey(n)<<endl; return 0; } I couldn't

  • C++ Code: How do I get this code to display True/False instead of 0/1? cout <<...

    C++ Code: How do I get this code to display True/False instead of 0/1? cout << "Is the Mountain bike equal to BMX bike?: " << bikeBMXObj.equals(bikeMountainObj) << endl;    cout << "Is the Standard bike equal to the Racer bike?: " << bikeRacerObj.equals(bikeStandardObj) << endl;

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT