Click here to Skip to main content
15,920,468 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: How to egalise two strings Pin
garfaoui27-Jul-07 0:50
garfaoui27-Jul-07 0:50 
AnswerRe: How to egalise two strings Pin
Cedric Moonen27-Jul-07 0:58
Cedric Moonen27-Jul-07 0:58 
AnswerRe: How to egalise two strings Pin
toxcct27-Jul-07 0:57
toxcct27-Jul-07 0:57 
GeneralRe: How to egalise two strings Pin
Cedric Moonen27-Jul-07 0:59
Cedric Moonen27-Jul-07 0:59 
GeneralRe: How to egalise two strings Pin
Jonathan [Darka]27-Jul-07 1:08
professionalJonathan [Darka]27-Jul-07 1:08 
GeneralRe: How to egalise two strings Pin
Cedric Moonen27-Jul-07 1:11
Cedric Moonen27-Jul-07 1:11 
GeneralRe: How to egalise two strings [modified] Pin
toxcct27-Jul-07 1:11
toxcct27-Jul-07 1:11 
QuestionRe: How to egalise two strings Pin
garfaoui27-Jul-07 2:10
garfaoui27-Jul-07 2:10 
If somebody is motivated to understand that, i have tried to regroup and order the programme. I hope you will help me.


#include <cstdlib><br />
#include <iostream><br />
using namespace std;<br />
#include<fstream><br />
#include<stdio.h>  <br />
#include <time.h><br />
#include <sstream><br />
#include<string><br />
<br />
int main()<br />
{<br />
<br />
// Openning the flow :<br />
            <br />
fstream list;<br />
list.open("listfile.txt",ios::in);<br />
<br />
// Decalaration of the variables:<br />
char t;<br />
int i;<br />
string s1;<br />
string s2;<br />
string s3;<br />
string s4;<br />
string s5;<br />
string s6;<br />
string s7;<br />
string s8;<br />
string s9;<br />
string s10;<br />
string s11;<br />
<br />
//Getting the name of the files:<br />
<br />
getline(list,s1);cout<<s1<<endl;<br />
getline(list,s2);cout<<s2<<endl;<br />
getline(list,s3);cout<<s3<<endl;<br />
getline(list,s4);cout<<s4<<endl;<br />
getline(list,s5);cout<<s5<<endl;<br />
getline(list,s6);cout<<s6<<endl;<br />
getline(list,s7);cout<<s7<<endl;<br />
getline(list,s8);cout<<s8<<endl;<br />
getline(list,s9);cout<<s9<<endl;<br />
getline(list,s10);cout<<s10<<endl;<br />
getline(list,s11);cout<<s11<<endl;<br />
<br />
// Getting the date :    <br />
	<br />
	time_t date_codee;<br />
	tm * date;<br />
    ostringstream ostr(ostringstream::out);<br />
	date_codee = time(NULL);<br />
	date = localtime(&date_codee);<br />
	ostr << "clippr-" <br />
		 << date->tm_mday <br />
		 <<"-"<br />
         << date->tm_mon + 1 <br />
		 <<"-"<br />
		 << date->tm_year + 1900<br />
		 << ".txt";<br />
<br />
<br />
//Declaration of the variables:<br />
<br />
int a1=0;<br />
int a2=0;<br />
int a3=0;<br />
int a11=0;<br />
int a4=0;<br />
int a5=0;<br />
int a6=0;<br />
int a7=0;<br />
int a8=0;<br />
int a9=0;<br />
int a10=0;<br />
char c;<br />
char t1;<br />
char t2;<br />
char t3;<br />
char t11;<br />
char t4;<br />
char t5;<br />
char t6;<br />
char t7;<br />
char t8;<br />
char t9;<br />
char t10;<br />
char f;<br />
<br />
// Opening clippr´ flow:<br />
<br />
fstream clippr;<br />
clippr.open("clippr.txt",ios::in);<br />
<br />
// Opening the files´ flow :<br />
<br />
fstream fichier1;<br />
fichier1.open(s1.c_str(),ios::in);<br />
<br />
fstream fichier2;<br />
fichier2.open(s2.c_str(),ios::in); <br />
<br />
fstream fichier3;<br />
fichier3.open(s3.c_str(),ios::in);<br />
<br />
fstream fichier11;<br />
fichier11.open(s11.c_str(),ios::in);<br />
<br />
fstream fichier4;<br />
fichier4.open(s4.c_str(),ios::in);<br />
<br />
fstream fichier5;<br />
fichier5.open(s5.c_str(),ios::in);<br />
<br />
fstream fichier6;<br />
fichier6.open(s6.c_str(),ios::in);<br />
<br />
fstream fichier7;<br />
fichier7.open(s7.c_str(),ios::in);<br />
<br />
fstream fichier8;<br />
fichier8.open(s8.c_str(),ios::in);<br />
<br />
fstream fichier9;<br />
fichier9.open(s9.c_str(),ios::in);<br />
<br />
fstream fichier10;<br />
fichier10.open(s10.c_str(),ios::in);<br />
<br />
// Getting the file lines:<br />
           <br />
string c1;string c2; string c3;<br />
string f1;string f2; string f3;<br />
getline(clippr,c1);<br />
getline(clippr,c1);cout<<c1<<endl;<br />
getline(clippr,c2);cout<<c2<<endl;<br />
getline(clippr,c3);cout<<c3<<endl;<br />
<br />
getline(fichier1,f1);<br />
getline(fichier1,f1);cout<<f1<<endl;<br />
getline(fichier1,f2);cout<<f2<<endl;<br />
getline(fichier1,f3);cout<<f3<<endl;<br />
<br />
 // If one of the character is different then ai->1 :             <br />
              <br />
              if (c1==f1&&c2==f2&&c3==f3) <br />
                        {a1=1;}<br />
     // I WILL REPEAT IT FOR EACH FICHIER         <br />
              <br />
// Closing the flows<br />
<br />
clippr.close();<br />
fichier1.close();<br />
fichier2.close();<br />
fichier3.close();<br />
fichier11.close();<br />
fichier4.close();<br />
fichier5.close();<br />
fichier6.close();<br />
fichier7.close();<br />
fichier8.close();<br />
fichier9.close();<br />
fichier10.close();<br />
<br />
// Clippr isn´t one of those files:<br />
if (a1==1) {cout<<"fichier1 is not clippr"<<endl;  }<br />
if (a2==1) {cout<<"fichier2 is not clippr"<<endl;  }<br />
if (a3==1) {cout<<"fichier3 is not clippr"<<endl;  }<br />
if (a11==1){cout<<"fichier11 is not clippr"<<endl; }<br />
if (a5==1) {cout<<"fichier5 is not clippr"<<endl;  }<br />
if (a4==1) {cout<<"fichier4 is not clippr"<<endl;  }<br />
if (a6==1) {cout<<"fichier6 is not clippr"<<endl;  }<br />
if (a7==1) {cout<<"fichier7 is not clippr"<<endl;  }<br />
if (a8==1) {cout<<"fichier8 is not clippr"<<endl;  }<br />
if (a9==1) {cout<<"fichier9 is not clippr"<<endl;  }<br />
if (a10==1){cout<<"fichier10 is not clippr"<<endl; }<br />
<br />
//Clippr is one of those files:<br />
         <br />
if (a1==0) {cout<<"fichier1 is clippr"<<endl;<br />
            rename(s1.c_str(), ostr.str().c_str());}<br />
<br />
<br />
// To keep the window open (due to dev-c++) :<br />
<br />
cin>>t1;}<br />

AnswerRe: How to egalise two strings Pin
toxcct27-Jul-07 2:19
toxcct27-Jul-07 2:19 
AnswerRe: How to egalise two strings Pin
ShilpiP27-Jul-07 2:11
ShilpiP27-Jul-07 2:11 
GeneralRe: How to egalise two strings Pin
toxcct27-Jul-07 2:14
toxcct27-Jul-07 2:14 
GeneralRe: How to egalise two strings Pin
garfaoui27-Jul-07 2:18
garfaoui27-Jul-07 2:18 
GeneralRe: How to egalise two strings Pin
toxcct27-Jul-07 2:21
toxcct27-Jul-07 2:21 
JokeRe: How to egalise two strings Pin
CPallini27-Jul-07 2:27
mveCPallini27-Jul-07 2:27 
GeneralRe: How to egalise two strings Pin
toxcct27-Jul-07 2:31
toxcct27-Jul-07 2:31 
GeneralRe: How to egalise two strings Pin
CPallini27-Jul-07 2:37
mveCPallini27-Jul-07 2:37 
GeneralRe: How to egalise two strings Pin
garfaoui27-Jul-07 2:28
garfaoui27-Jul-07 2:28 
GeneralRe: How to egalise two strings Pin
toxcct27-Jul-07 2:32
toxcct27-Jul-07 2:32 
GeneralRe: How to egalise two strings Pin
garfaoui27-Jul-07 2:35
garfaoui27-Jul-07 2:35 
GeneralRe: How to egalise two strings Pin
toxcct27-Jul-07 2:39
toxcct27-Jul-07 2:39 
GeneralRe: How to egalise two strings Pin
garfaoui27-Jul-07 2:44
garfaoui27-Jul-07 2:44 
GeneralRe: How to egalise two strings Pin
garfaoui27-Jul-07 2:49
garfaoui27-Jul-07 2:49 
GeneralRe: How to egalise two strings [modified] Pin
toxcct27-Jul-07 2:50
toxcct27-Jul-07 2:50 
GeneralRe: How to egalise two strings Pin
Rage27-Jul-07 2:56
professionalRage27-Jul-07 2:56 
GeneralRe: How to egalise two strings Pin
garfaoui27-Jul-07 2:57
garfaoui27-Jul-07 2:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.