TP de C++
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

exercice1.cpp 528B

1234567891011121314151617181920212223242526272829303132
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. int main(/*int argc, char const *argv[]*/)
  5. {
  6. vector<float> v1;
  7. for(float i=0.0;i<1.0;i+=0.1){
  8. v1.push_back(i);
  9. }
  10. for(vector<float>::iterator it1 = v1.begin();it1!=v1.end();it1++){
  11. cout << *it1 << endl;
  12. }
  13. cout <<"2e partie : " << endl;
  14. vector<float> v2=v1;
  15. uint val=(v2.end()-v2.begin())/2;
  16. for(uint y=0; y<val;y++){
  17. v2.pop_back();
  18. }
  19. for(vector<float>::iterator it3 = v2.begin();it3!=v2.end();it3++){
  20. cout << *it3 << endl;
  21. }
  22. return 0;
  23. }