ورود

View Full Version : مبتدی: برنامه ساده شی گرایی در ویژوال سی پلاس پلاس(لطفا کمک کنید)



majid6
دوشنبه 25 اسفند 1393, 09:43 صبح
باسلام به همه دوستان.لطف کنید راهنماییم کنید که مشکل برنامه نوشته شده من چیه؟
که البته اینجا که کپی پیست کردم یه خورده به هم ریخته شده.تو این لینک (http://s4.picofile.com/file/8177304226/304.txt.html) فایل تکست کم حجمش رو قرار دادم.
عکس زیر هم ارور هایی هست که ویژوال استادیو2012 از من گرفته.
لطفا کمک کنید.ممنون




// 304.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<iostream>
#include<conio.h>
using namespace std;

class Ratio
{
public:
void assign(int,int);
void print();

private:
int num, den;

};

/*Ratio::Ratio()
{
}

Ratio::~Ratio()
{
}*/


int _tmain(int argc, _TCHAR* argv[])
{
Ratio x;
Ratio y;
x.assign(13,7);
y.assign(19,5);
cout<<"x=";
x.print();
cout<<endl;
cout<<"y=";
y.print();
cout<<endl;
return 0;
//_getch;
}
void Ratio::assign(int numerator, int denumierator); //numerator?numirator
{
num=numerator;
den=denumirator;
}
void Ratio::print()
{
cout<<num<<'/'<<den;
}
129471

negative60
دوشنبه 25 اسفند 1393, 13:12 عصر
(لازم نيست کدهاتون رو آپلود کنيد کافيه از تگ ++C استفاده کنيد)

تو محيط کد نويسی ويژوال اول با Ctrl + A تا تمام نوشته های صفحه رو سلکت کنيد بعد Ctrl+K+F رو بزنيد تا کدهاتون مرتب بشه.



#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;


class Ratio
{
public:
void assign(int,int);
void print();


private:
int num, den;


};


int _tmain(int argc, _TCHAR* argv[])
{
Ratio x;
Ratio y;
x.assign(13,7);
y.assign(19,5);
cout << "x=";
x.print();
cout << endl;
cout << "y=";
y.print();
cout << endl;
return 0;
//_getch;
}
void Ratio::assign(int numerator, int denumierator)
{
num = numerator;
den = denumierator;
}
void Ratio::print()
{
cout << num<< '/' << den;
}




تمام خطا ها تون املايی بود اگر يکم دقت کنيد و خطا ها رو برسی کنيد به راحتی مشکل رو پيدا ميکنيد.

majid6
دوشنبه 25 اسفند 1393, 14:45 عصر
ممنون از راهنمایی شما negative60 (http://barnamenevis.org/member.php?311130-negative60) .بله به ایراد هام پی بردم.

majid6
دوشنبه 25 اسفند 1393, 14:49 عصر
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr