so...i dont really understand my project -_-
the teacher is asian as am i
but he does not write english very well :3

can i get some hints maybe? ^_^

thank you i really appreciate it ive been stumped for such a long time :O


"I typed the following 2 lines and made several mistakes. As you will immediately notice, I have written Gcc for gcc. I want you to help me fix these errors by writing a C++ program to replace the incorrect statements with the correct ones. For now, assume that we will type these two lines from the keyboard. So you will read the two sentences from the keyboard, and will display the corrected sentences at the end. "


"G++ is a script to call Gcc with options to recognize C++.
Gcc processes input files through one or more stages."

#include <iostream>
#include <vector>
using namespace std;

int main()
{
  vector<int> vectorObject;
  int i;

  for(i = 0; i <10; i++) 
      vectorObject.push_back(i);

  cout << "Initial: ";
  for(i = 0; i <vectorObject.size(); i++) 
     cout << vectorObject[i] << " ";
  cout << endl;

 
  cout << "Reversed: ";
  //your code goes here.

  return 0;
}

Recommended Answers

All 4 Replies

I don't understand what you are asking. How to output the vector in referse order? Just create a loop that counts backwards.

im not so sure either -_-
this teacher needs to learn to type directions better :D

i think the vector must be made to backwards order

how to create backwards loop
for? while? do?

i apologize im not sure how you mean =_=

>>how to create backwards loop

for(int i = vectorObject.size()-1; i >= 0; --i)
{
   // blabla
}

-_-
the sad thing is i knew about that but didnt even think about that i hate for loops

thanks! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.