Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <cmath>
- #include <stdio.h>
- #include <cstdlib>
- using namespace std;
- //Napisz program, który jako argumenty (argumenty funkcji main) otrzymuje dwa ciągi liczb całkowitych oddzielone przecinkiem. Program ma zaipsać do pliku o nazwie liczby.txt te liczby, które występują w obu ciągach.
- int main(int argc, char** argv)
- {
- string ciag, czlon1, czlon2,tmp;
- int tab1[czlon1.length()];
- int tab2[czlon2.length()];
- for(int i=1; i<argc; i++)
- {
- ciag =ciag + argv[i] + " ";
- }
- size_t pozycja = ciag.find(",");
- czlon1 = ciag.substr(0,pozycja);
- czlon2 = ciag.substr(pozycja+2,ciag.length());
- cout<<"ciagi to: "<<endl<<czlon1<<endl<<czlon2<<"sss"<<endl<<endl;
- for(int i=0;i<czlon1.length()+3;i++) //tab1 uzupelniamy //////////////////////////////////////////////////???????????????????????????????????????????????? i<?
- {
- pozycja = czlon1.find(" ");
- tmp = czlon1.substr(0,pozycja);
- czlon1.erase(0,pozycja+1);
- tab1[i] = atoi(tmp.c_str());
- }
- for(int i=0;i<=czlon2.length()+2;i++) //tab2 uzupelniamy /////////////////////////////???????????????????????????????????????????????? i<?
- {
- pozycja = czlon2.find(" ");
- tmp = czlon2.substr(0,pozycja);
- czlon2.erase(0,pozycja+1);
- tab2[i] = atoi(tmp.c_str());
- }
- for(int i = 0; i<5; i++) //////////////////////////////////////////////////////////////////////////???????????????????????????????????????????????? i<?
- {
- cout<<"liczby z tabelki to: "<<endl<<tab1[i]<<" "<<tab2[i]<<endl ;
- }
- cout<<endl<<endl;
- for(int i=0;i<5;i++) //////////////////////////////////////////////////////////////////////////???????????????????????????????????????????????? i<?
- {
- for(int j=0;j<5;j++) /////////////=/////////////////////////???????????????????????????????????????????????? i<?
- {
- if(tab1[i]==tab2[j])
- cout<<"Wyniki to: "tab1[i]<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment