#include <array> [message #1084547] |
Sun, 11 August 2013 18:56 |
Jack Kowalski Messages: 5 Registered: August 2013 |
Junior Member |
|
|
I added the compiler flag -std=c++11, and -gnu=c++11 but I get can not resolve the line of sample code array<double, 5> rain;
what else do I need to set to include c++11??, thanks.
sample code below, btw the double rain[5]; works just fine.... I know its the set up can you help get me to the correct doc or settings example, I love the Eclipse, just need to learn how to use it.
Ubuntu 12.04
gcc 4.7
g++ 4.7
gnu 4.7
my sample code below:::
#include <iostream>
#include <string>
#include <array> ////// <<<<<<<<<< this is ok
using namespace std;
void PrintArray(double[], int size);
void inputArray(double aray[], int size);
int main()
{
// double rain[5]; //////////// <<<<<<<<<<<<<<< this is ok
array <double, 5> rain; // <<<< ERRROR is here, cant resolve array-- WT
rain[0] = 33.0;
rain[1] = 33.1;
rain[2] = 33.2;
rain[3] = 33.3;
rain[4] = 33.4;
PrintArray(rain, 5);
inputArray(rain,5);
PrintArray(rain, 5);
return 0;
}
void PrintArray(double aray[], int size)
{
for(int i = 0; i < size; i++)
{
cout << endl << "these are the current rain array entries = "<< aray[i];
}
}
void inputArray(double aray[], int size)
{
for(int i = 0; i < size; i++)
{
cout << endl << "enter a value to fill the array "<< endl;
cin >> aray[i];
}
}
|
|
|
Re: #include <array> [message #1084555 is a reply to message #1084547] |
Sun, 11 August 2013 19:11 |
Ed Merks Messages: 33158 Registered: July 2009 |
Senior Member |
|
|
Jack,
It's best to ask about C++ things on the CDT forum.
On 11/08/2013 8:56 PM, Jack Kowalski wrote:
> :x
> I added the compiler flag -std=c++11, and -gnu=c++11 but I get can not
> resolve the line of sample code array<double, 5> rain;
>
> what else do I need to set to include c++11??, thanks.
> sample code below, btw the double rain[5]; works just fine.... I know
> its the set up can you help get me to the correct doc or settings
> example, I love the Eclipse, just need to learn how to use it.
>
> Ubuntu 12.04
> gcc 4.7
> g++ 4.7
> gnu 4.7
>
> my sample code below:::
>
>
> #include <iostream>
> #include <string>
> #include <array> ////// <<<<<<<<<< this is ok
>
>
> using namespace std;
>
>
> void PrintArray(double[], int size);
> void inputArray(double aray[], int size);
>
>
> int main()
> {
>
>
> // double rain[5]; //////////// <<<<<<<<<<<<<<< this is ok
> array <double, 5> rain; // <<<< ERRROR is here, cant resolve
> array-- WT
>
> rain[0] = 33.0;
> rain[1] = 33.1;
> rain[2] = 33.2;
> rain[3] = 33.3;
> rain[4] = 33.4;
>
>
> PrintArray(rain, 5);
> inputArray(rain,5);
> PrintArray(rain, 5);
>
> return 0;
> }
>
> void PrintArray(double aray[], int size)
> {
>
> for(int i = 0; i < size; i++)
> {
> cout << endl << "these are the current rain array entries =
> "<< aray[i];
> }
> }
>
>
> void inputArray(double aray[], int size)
> {
>
> for(int i = 0; i < size; i++)
> {
> cout << endl << "enter a value to fill the array "<< endl;
> cin >> aray[i];
> }
>
>
> }
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08256 seconds