Bug 31737 - Problem using <string> STL with g++ 3.4.6
Summary: Problem using <string> STL with g++ 3.4.6
Status: RESOLVED DUPLICATE of bug 31735
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.6
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-28 18:47 UTC by Leonardo
Modified: 2007-04-28 19:16 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leonardo 2007-04-28 18:47:43 UTC
Hi,

I must tried to run an program in g++3.4.6, and it gives an wrong answer.
This problem does not occur in g++ 2.95.
I am using debian etch.
Se the C++ code below:

////////////////////////////////////////////////////begin-code/////////
#include<iostream>
#include<string>
using namespace std;
	
int main(){

	int  n, nn; 
	string vector[54], word;
	
	cin >> nn;
	for (int i=0; i<nn; i++){
		cin >> word;			
		for (int j=0; j<word.size(); j++){ vector[i][j] = word[j];}
	} 
	for (int k=0; k<nn; k++){			
		for (int l=0; l<word.size(); l++){ cout << vector[k][l];}
		cout << endl;
	}
	return 0;
}
////////////////////////////////////////////////////end-code//////////////

As you can see, if you run the program and give any input, it gives you only the last input.

But if you run with g++-2.95, there's no problem.


Thanks.
Comment 1 Paolo Carlini 2007-04-28 19:16:53 UTC

*** This bug has been marked as a duplicate of 31735 ***