wonman

Untitled

Feb 26th, 2015
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstdlib>
  4. #include <stdio.h>
  5. using namespace std;
  6.  
  7. int main(int argc, char* argv[])
  8. {
  9.  
  10. string ciag;
  11.  
  12.  
  13. for(int i=0; i<argc;i++)
  14. {
  15.     ciag = ciag + argv[i] + " ";   
  16.  
  17. }
  18. ciag = "1 2 3 4 5 6 ";
  19. cout<<ciag<<endl;  
  20.  
  21. float tab[100];
  22. string nowy;
  23. for(int i=0; i<argc;i++)
  24. {
  25.     size_t pozycja = ciag.find(" ");
  26.     nowy = ciag.substr(0,pozycja);
  27.     tab[i] = atof(nowy.c_str());
  28.     ciag.erase(0,2);
  29. }
  30.  
  31. for(int i; i<argc-1;i++)
  32. cout<<tab[i]<<endl;
  33.  
  34. cout<<endl;
  35.  
  36. for(int i=0; i<argc-1;i++)
  37. {
  38.     if (tab[i]==0){
  39.    
  40.     cout<<"1";
  41. }
  42. else
  43. {
  44.     cout<<1/tab[i]<<endl;
  45. }
  46.    
  47. }
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment