PDA

View Full Version : کمک ارور در clrscr



changi22
جمعه 11 اردیبهشت 1394, 17:08 عصر
سلام من یک ماترس نوشتم تو ویژوال استدیو تو قسمت C++‎‎‎ و بعد clr C++‎‎‎ از clrscr ارورر میگیره ترو خدا کمک کنید اینم ارورش
error c3861:"clrscr" not fond یکیی کمک کنه بگه مشکل کجاس اینم کدش

#include "stdafx.h"
#include <iostream>
#include <conio.h>
void clrscr()
{
system("cls");
}
using namespace std;


int baz=0,mot=0,nmot=0,taad=0;
int n;
int mat[10][10];


void baztabi()
{
int count=0;


for(int q=0;q<n;q++)
for(int x=0;x<n;x++)
if(q==x&&mat[q][x]==1)
count++;
if(count==n){
baz=1;
cout<<"baztabi";}
else
cout<<"baztabi nist";


}


void gheyre_baztabi()
{


int count1=0;


for(int ii=0;ii<n;ii++)
for(int jj=0;jj<n;jj++)
if(ii==jj&&mat[ii][jj]==0)
count1++;


if(count1==n)


cout<<"\nGeyre baztabi";
else
cout<<"\n Gheayre baztabi nist";


}
void tagharon()
{
int count=0;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
if(mat[i][j]!=mat[j][i])
count++;
if(count>0)
{
nmot=1;
cout<<"\nmotegharen nist";}
else
cout<<"\nmotgharen";
}


void pad_tagharon()
{
int count=0;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
if(i==j&&j-1>=0&&j+1<=n&&mat[i][j-1]!=mat[i][j+1])
count++;
if(count==n-2)
{
mot=1;
cout<<"\npad motegharen";}
else
cout<<"\npad motgharen nist";
}
void taadi()
{
int i,j,k,c=1;
int mat2[10][10]={0};
for(i = 0 ; i < n ; i++)
for(j = 0 ; j < n ; j++)
for(k = 0 ;k < n ; k ++){
mat2[i][j] = mat2[i][j] + mat[i][k]* mat[k][j];}
for(i = 0 ; i < n ; i++)
for(j = 0 ; j < n ; j++){
if(mat2[i][j]>=1)
mat2[i][j]=1;
if(mat2[i][j]>mat[i][j])
c=0;
}


if(c==1)
{
cout<<"\ntaadi";
taad=1;}


else
cout<<"\ntaadi nist";
}








void bastar_taadi()


{
clrscr();
cout<<"Bastar tadi\n";
int i,j,k;
int mat2[10][10]={0};
for(int a=0;a<n-1;a++)
for(i = 0 ; i < n ; i++)
for(j = 0 ; j < n ; j++)
for(k = 0 ;k < n ; k ++){
mat2[i][j] = mat2[i][j] + mat[i][k]* mat[k][j];}
for(i = 0 ; i < n ; i++)
for(j = 0 ; j < n ; j++)
if(mat2[i][j]>1)
mat2[i][j]=1;


for(int x=0;x<n;x++)
{ for(int y=0;y<n;y++)
cout<<mat2[x][y]<<" ";
cout<<"\n";
}


}
void bastar_motegharen()
{ clrscr();
cout<<"\nbastar motegharen\n";
int mat3[10][10]={0};
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
mat3[i][j]=mat[i][j];
for(int w=0;w<n;w++)
for(int z=0;z<n;z++)
if(mat[z][w]==1 && z!=w)
{
//mat[w][z]=1;
mat3[w][z]=1;
}




for(int x=0;x<n;x++)
{
for(int y=0;y<n;y++)
cout<<mat3[x][y]<<" ";
cout<<"\n";}




}


void bastar_baztabi()
{ clrscr();
cout<<"bastar baztabi\n";
int mat4[10][10]={0};
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
mat4[i][j]=mat[i][j];
for(int w=0;w<n;w++)
for(int z=0;z<n;z++)
if(w==z&&mat4[w][z]==0)
mat4[w][z]=1;


for(int x=0;x<n;x++)
{ for(int y=0;y<n;y++)
cout<<mat4[x][y]<<" ";
cout<<"\n";}




}


void main()
{
clrscr();
cout<<"Enter a size matris :";
cin>>n;




for(int i=0;i<n;i++){
cout<<"please enter " <<i+1<< " row:";
for(int j=0;j<n;j++)
cin>>mat[i][j];
}
clrscr();
for(int k=0;k<n;k++){
for(int g=0;g<n;g++)
cout<<mat[k][g]<<" ";
cout<<"\n";
}
getch();


baztabi();
getch();
gheyre_baztabi();
getch();
tagharon();
getch();
pad_tagharon();
getch();
taadi();
if(taad==1 && baz==1 && mot==1)
cout<<"\n ham arz ast";
else
cout<<"\nham arz nist";
getch();
bastar_taadi();
getch();
bastar_motegharen();
getch();
bastar_baztabi();
getch();
}

linux
جمعه 11 اردیبهشت 1394, 23:21 عصر
دست از سر این conio.h بردارد.


#include <iostream>
using namespace std;


void clrscr()
{
system("cls");
}


void pause()
{
cin.ignore();
cin.ignore();
}


int baz = 0, mot = 0, nmot = 0, taad = 0;
int n;
int mat[10][10];




void baztabi()
{
int count = 0;


for (int q = 0; q < n; q++)
for (int x = 0; x < n; x++)
if (q == x&&mat[q][x] == 1)
count++;
if (count == n){
baz = 1;
cout << "baztabi";
}
else
cout << "baztabi nist";




}




void gheyre_baztabi()
{
int count1 = 0;
for (int ii = 0; ii < n; ii++)
for (int jj = 0; jj < n; jj++)
if (ii == jj&&mat[ii][jj] == 0)
count1++;
if (count1 == n)
cout << "\nGeyre baztabi";
else
cout << "\nGheayre baztabi nist";




}
void tagharon()
{
int count = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (mat[i][j] != mat[j][i])
count++;
if (count > 0)
{
nmot = 1;
cout << "\nmotegharen nist";
}
else
cout << "\nmotgharen";
}




void pad_tagharon()
{
int count = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (i == j&&j - 1 >= 0 && j + 1 <= n&&mat[i][j - 1] != mat[i][j + 1])
count++;
if (count == n - 2)
{
mot = 1;
cout << "\npad motegharen";
}
else
cout << "\npad motgharen nist";
}
void taadi()
{
int i, j, k, c = 1;
int mat2[10][10] = { 0 };
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
for (k = 0; k < n; k++){
mat2[i][j] = mat2[i][j] + mat[i][k] * mat[k][j];
}
for (i = 0; i < n; i++)
for (j = 0; j < n; j++){
if (mat2[i][j] >= 1)
mat2[i][j] = 1;
if (mat2[i][j] > mat[i][j])
c = 0;
}




if (c == 1)
{
cout << "\ntaadi";
taad = 1;
}




else
cout << "\ntaadi nist";
}
















void bastar_taadi()




{
clrscr();
cout << "Bastar tadi\n";
int i, j, k;
int mat2[10][10] = { 0 };
for (int a = 0; a < n - 1; a++)
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
for (k = 0; k < n; k++){
mat2[i][j] = mat2[i][j] + mat[i][k] * mat[k][j];
}
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
if (mat2[i][j]>1)
mat2[i][j] = 1;




for (int x = 0; x < n; x++)
{
for (int y = 0; y < n; y++)
cout << mat2[x][y] << " ";
cout << "\n";
}




}
void bastar_motegharen()
{
clrscr();
cout << "\nbastar motegharen\n";
int mat3[10][10] = { 0 };
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
mat3[i][j] = mat[i][j];
for (int w = 0; w < n; w++)
for (int z = 0; z < n; z++)
if (mat[z][w] == 1 && z != w)
{
//mat[w][z]=1;
mat3[w][z] = 1;
}








for (int x = 0; x < n; x++)
{
for (int y = 0; y < n; y++)
cout << mat3[x][y] << " ";
cout << "\n";
}








}




void bastar_baztabi()
{
clrscr();
cout << "bastar baztabi\n";
int mat4[10][10] = { 0 };
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
mat4[i][j] = mat[i][j];
for (int w = 0; w < n; w++)
for (int z = 0; z < n; z++)
if (w == z&&mat4[w][z] == 0)
mat4[w][z] = 1;




for (int x = 0; x < n; x++)
{
for (int y = 0; y < n; y++)
cout << mat4[x][y] << " ";
cout << "\n";
}








}




void main()
{
clrscr();
cout << "Enter Matrix size:";
cin >> n;


cout << "Please enter Matrix Data ..." << endl;
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
cout << "[" << i << "," << j << "]=";
cin >> mat[i][j];
}
}
clrscr();
for (int k = 0; k < n; k++){
for (int g = 0; g < n; g++)
cout << mat[k][g] << " ";
cout << "\n";
}
pause();




baztabi();


pause();
gheyre_baztabi();
pause();
tagharon();
pause();
pad_tagharon();
pause();
taadi();
if (taad == 1 && baz == 1 && mot == 1)
cout << "\n ham arz ast";
else
cout << "\nham arz nist";
pause();
bastar_taadi();
pause();
bastar_motegharen();
pause();
bastar_baztabi();
pause();
}

changi22
شنبه 12 اردیبهشت 1394, 10:32 صبح
ممنون درست شد ولی یک ارور دیگه هم میده اینم عکسش
http://www.axgig.com/images/56284961393936110459.jpg
ممنون

omid_kma
شنبه 12 اردیبهشت 1394, 19:20 عصر
دیگه ارور از این واضح تر ؟!
Did you forget to add #include "stdafx.h" to your source ?

changi22
شنبه 12 اردیبهشت 1394, 21:33 عصر
من برنامه نویسی بلد نیستم اینم برا کلاس میخواستم تا اینجاشو با هم کلاسیم نوشتم
الان یعنیی کتابخونه #include "stdafx.h" اضافه کنم؟
گذاتم اروور ها بیشتر شد

linux
شنبه 12 اردیبهشت 1394, 22:29 عصر
من برنامه نویسی بلد نیستم اینم برا کلاس میخواستم تا اینجاشو با هم کلاسیم نوشتم
الان یعنیی کتابخونه #include "stdafx.h" اضافه کنم؟
گذاتم اروور ها بیشتر شد
شما وقتی پروژه می سازی بعد از اینکه console application را انتخاب کردی از قسمت additional option فقط empty project را تیک بزن.