473,395 Members | 1,411 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how do i remove the constant expression required in this program?

#include<iostream.h>
#include<conio.h>

class mtr
{
int m,n,i,j;
int ar[m][n];

public:
mtr()
{
for(int p=0;p<m ; p++)
{
for(int q=0;q<n;q++)
{
ar[p][q]=0;
}
}
}
void read();
void display();
};

void mtr::read()
{
cout<<"enter dimensions of matrix \n";
cin>>m>>n;
cout<<"now enter elements of matrix: \n";
for(i=0;i<m ; i++)
{
for(j=0;j<n;j++)
{
cin>>ar[i][j];
}
}
}

void mtr::display()
{
cout<<"the matrix entered by you is : \n";
for(i=0;i<m ; i++)
{
for(j=0;j<n;j++)
{
cout<< ar[i][j]=0;
}
}
cout<<"thank you";
}

void main()
{
mtr r;
r.read();
clrscr();
r.display();
getch();
}
Sep 14 '14 #1
1 5014
weaknessforcats
9,208 Expert Mod 8TB
I have no idea what const expression you are referring to.
Sep 14 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: pvinodhkumar | last post by:
The number of elemets of the array, the array bound must be constant expression?Why is this restriction? Vinodh
13
by: devdatta_clc | last post by:
Hi C experts I've a bunch of questions. Consider this simplified piece of code. const int a = 10; int main () { static int b = a;
13
by: hn.ft.pris | last post by:
Hi: I have the following simple program: #include<iostream> using namespace std; int main(int argc, char* argv){ const double L = 1.234; const int T = static_cast<const int>(L); int arr;
11
by: kerravon | last post by:
According to 6.8 of C90, #if takes a constant expression. According to 6.4 of C90, the sizeof operator is part of a constant expression. Why then do most of my compilers barf on this? ...
1
by: ashiremath | last post by:
Hi All Below the code giving me the error is Constant expression is required. Please help me for this program. Private Sub Send_InputChoice() Dim Input_String As Integer ...
8
by: johnehein | last post by:
#include <vector> using namespace std; template <typename Iter> int foo(Iter first, Iter last, int nn) { const size_t n = last - first; double buf; return 0;
3
by: Dan Smithers | last post by:
What constitutes a constant-expression? I know that it is something that can be determined at compile time. I am trying to use template code and keep getting compiler errors "error: cannot...
3
by: Rob Blackmore | last post by:
I am trying to create an attribute of type Icon and have the following code: <AttributeUsage(AttributeTargets.Class)_ Public Class PIMSGridViewIconAttribute Inherits System.Attribute '///...
56
by: Adem | last post by:
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" The C++ Standard (ISO/IEC 14882, Second edition, 2003-10-15) says under...
8
by: PJ6 | last post by:
Const factor As Double = Math.Sqrt(3) / 6 Error 1 Constant expression is required. This looks like laziness to me. In SQL Server, functions are given a distinction between ones that always...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.