Ask your own question, for FREE!
Computer Science 13 Online
OpenStudy (ajprincess):

Can someone plzzz check this code?

OpenStudy (ajprincess):

#include<iostream> using namespace std; int main() { string word[5]; int i; for(i=0; i<5; i++) { cout<<"Enter the word"<<i<<endl; cin>>word[i]; } for(i=1; i<6; i++) { cout<<i<<"."<<word[i]<<endl; } system("PAUSE"); return 0; }

OpenStudy (anonymous):

did you #include <string> ?

OpenStudy (ajprincess):

The question is Write a C++ program to enter "Object Oriented Programming Using C++" using keyboard and display it in the console as the following style 1.Object 2.Oriented 3.Programming 4.Using 5.C++

OpenStudy (ajprincess):

No. I didn't include it.

OpenStudy (anonymous):

Also, since you loop from i=1 to 6 in the second loop, you will be referencing memory outside the array. If you make it from i=0 to 4 (i.e. i=0; i<5) it will work

OpenStudy (anonymous):

http://ideone.com/6b8mp

OpenStudy (ajprincess):

Perfect nw. Thanxxxxxxxxxxxx a lt.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!