May 28, 2017 at 4:07am May 28, 2017 at 4:07am UTC
Hi, i am looking for way to practice coding in latest version of C++ that is in use in market for professionals. Currently i am using Dev C++ Ver 5.11. I would like to upgrade my software version to latest. Can any of the C++ experts show me or provide me the way to download latest version. I get to problem with old version while coding 2 Dimensional array. Ver 5.11 did not support lambda functions. Looking forward for help and suggestions. Thank you in advance.
May 28, 2017 at 4:18am May 28, 2017 at 4:18am UTC
If you are using Windows getting Visual Studio 2017 might be a good idea:
https://www.visualstudio.com/downloads/
Visual Studio 2017 Community is free.
There is also Visual Studio Code, a less bulky IDE.
May 28, 2017 at 9:44pm May 28, 2017 at 9:44pm UTC
Hi,
I tried running code for 2D array in VS '17 with Win32 console. I still cannot run 2D array. It gives me error message.
/*
Name: 2Dimensional Array
Copyright:
Author:
Date: 27/05/17 23:29
Description:
*/
#include "stdafx.h"
#include<iostream>
#include<iomanip>
using namespace std;
const int row = 2;
const int column = 2;
int main()
{
int count;
int count1;
int array[row][column];
for (count = 0; count<row; count++)
{
for (count1 = 0; count1<column; count1++)
{
cout << "Enter array element for " << [count][count1] << " : ";
cin >> array[count][count1];
}
}
for (count = 0; count<row; count++)
{
for (count1 = 0; count1<column; count1++)
{
cout << "Array element you entered for " << [count][count1] << " is: " << endl;
}
}
return 0;
}
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1>Source.cpp
1>2017\projects\consoleapplication1\consoleapplication1\source.cpp(29): error C3260: '[': skipping unexpected token(s) before lambda body
1>2017\projects\consoleapplication1\consoleapplication1\source.cpp(36): error C3493: 'count1' cannot be implicitly captured because no default capture mode has been specified
1>2017\projects\consoleapplication1\consoleapplication1\source.cpp(44): fatal error C1903: unable to recover from previous error(s); stopping compilation
1>Done building project "ConsoleApplication1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any idea what i am missing thank you for your time and help.
Last edited on May 28, 2017 at 9:45pm May 28, 2017 at 9:45pm UTC
May 28, 2017 at 10:27pm May 28, 2017 at 10:27pm UTC
What are you trying to print out with this bit of code?
cout << "Enter array element for " << [count][count1]
Maybe something like this?
1 2 3 4
cout << "\nEnter array element for " << count << ":" << count1 << " : " ;
cin >> array[count][count1];
Enter array element for 0:0 : 1
Enter array element for 0:1 : 2
Enter array element for 1:0 : 3
Enter array element for 1:1 : 4
Last edited on May 28, 2017 at 10:27pm May 28, 2017 at 10:27pm UTC
May 28, 2017 at 11:34pm May 28, 2017 at 11:34pm UTC
Hi wildblue,
Yes you are correct, that's it. I tried it after the way you highlighted and it works perfect as i was expecting. It works in Dev C++ 4.11 but at same time as FurryGuy suggested VS '17 i got a taste of it and should start getting used to it too. Not a issue with software version.
I really appreciate for your time looking into the issue and bailing me out, if not i would have been spending another few more days and finally give up or just hanging there to solve the issue without catching hint.
Respect!
Updated code is:
/*
Name: 2Dimensional Array
Copyright:
Author:
Date: 27/05/17 23:29
Description:
*/
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
const int row = 2;
const int column = 2;
int count,
count1;
int array [row][column];
for( count=0;count<row;count++)
{
for( count1=0;count1<column;count1++)
{
cout<<"Enter array element for "<<count<<":"<<count1<<" : ";
cin>>array[count][count1];
}
}
for( count=0;count<row;count++)
{
for(count1=0;count1<column;count1++)
{
cout<<"Array element you entered for "<<count<<":"<<count1<<" is: "<<array[count][count1]<<endl;
}
}
cout<<array[1][0];
return 0;
}