Portali
Posto temė tė re Pėrgjigju temės Faqja 2 e 2
Shko tek faqja E mėparshme  1, 2
Ushtrime ne C++ 
Autori Mesazh

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Re: Ushtrime Ne C++ 
 
#include <iostream>
#include <string>
#include "Complex.h"

using namespace std;

namespace CS1124 {
    
    // CONSTRUCTORS
    // Since we used default arguments, we only have to implement one
    // version of the constructor.
    Complex::Complex(double r, double imag) {
        real = r;
        imaginary = imag;
    }

    // Decrement Operators --
    // =================================
    // Overloading the -- pre-increment unary operator.
    // Note the value returned is the "this pointer" dereferenced.
    // operator-- was declared a friend function in the Complex
    // class.  Must define the parameter as reference, otherwise
    // no change would be made to the object.

    Complex& operator-- (Complex& x) {
        x.real--;
        return x;
    }
    
    // Overloading the -- post-decrement operator.
    Complex operator-- (Complex& x, int) {
        Complex temp(x);
        x.real--;
        return temp;
    }
    

    // Increment Operators ++
    // ======================
    // Note that they are being defined as
    // member functions.  To do this requires we use "*this"
    // (known as "the this pointer") to refer to
    // the object that the member function is acting on.
    // If you are not familiar with the "this pointer", then just
    // use a non-member function definition as we show above
    // for the Decrement Operators.
    // ==========================================================
    // Overloading the ++ pre-increment operator.
    // Note the value returned is the "this pointer" dereferenced.
    Complex& Complex::operator++ () {
        real++;
        return *this;
    }    
    // Overloading the ++ post-increment operator.
    Complex Complex::operator++ (int) {
        Complex temp(*this);
        real++;
        return temp;
    }

    Complex& Complex::operator+=(const Complex& rhs) {
        real += rhs.real;
        imaginary += rhs.imaginary;
        return *this;
    }

    // Overloading the binary + operator to add two complex numbers.
    // This implementation makes use of the += operator and is a
    // commonly used convenient way to implement the + operator.
    // Notice that nothing about the code is unique to Complex
    // numbers and could just as well be written the same way for
    // any class that has the += operator implemented.
    // Also notice that the result is returned by value, meaning that
    // a copy will be made when it is returned.  This is important.
    // It must NOT be returned by reference because it is a local
    // variable to this function and won't exist after the function
    // exits.
    Complex operator+ (const Complex& lhs, const Complex& rhs) {
        Complex result = lhs;
        result += rhs;
        return result;
    }

    
    // An alternative way of implementing the + operator
    // that does not use +=.
    //Complex operator+ (const Complex& left, const Complex& right) {
    //    double realPart = left.getReal() + right.getReal();
    //    double imaginaryPart = left.getImaginary() + right.getImaginary();
    //    Complex c(realPart, imaginaryPart);
    //    return c;
    //}
    
    // Overloading the binary - operator to subtract two complex
    // numbers.  As in operator+ above, we are passing the arguments
    // by "constant reference" to avoid unnecessary copying.
    // No temporary variables are used inside the function.  All
    // computation is done inside the constructor.
    // Using a constructor to create the return value avoids an
    // additional copy when returning "by value".
    Complex operator- (const Complex& left, const Complex& right) {
        return Complex(left.getReal() - right.getReal(),
            left.getImaginary() - right.getImaginary());
    }
    
    // Overloading the output operator for complex numbers.
    // Note that, as usual the complex number is passed by
    // constant reference for efficiency.  However, the ostream
    // object is only passed by reference.  Why?  Because the
    // ostream object will have to change its internal state when
    // printing out the doubles "real" and "imaginary".
    // Note also that the ostream must be returned by reference.
    ostream& operator<< (ostream& os, const Complex& c) {
        os << c.getReal();
        if (c.getImaginary() >= 0) os << '+';
        os << c.getImaginary() << "i";
        return os;
    }
    
    // Overloading the input operator for complex numbers.
    // Note that the complex number is passed by reference
    // because we need to change it's value.
    // Also, the istream object is also passed by reference.  
    // Why?  Because the
    // istream object will have to change its internal state when
    // reading in the doubles "real" and "imaginary".
    // Note also that the istream must be returned by reference.
    istream& operator>> (istream& is, Complex& c) {
        double real, imaginary;
        // Critcal that we use char instead of string.  Why?
        char sign, i;
        is >> real >> sign >> imaginary >> i;
        c = Complex(real, (sign == '+') ? imaginary : -imaginary);
        return is;
    }
    
}
 




____________
Image
Image
Image
Offline Shiko profilin e anėtarit Dėrgo mesazh privat Vizito websitin e shkruesit Adresa e AIM Yahoo Messenger MSN Messenger Nr. i ICQ

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Re: Ushtrime Ne C++ 
 
A call to function f() assigns the return vector to resultV.  List the contents of resultV.

template <typename T>
vector<T> f(const vector<T>& x, const vector<T>& y)
{    vector<T> v = x;
    int i;

    for (i=0;i < y.size();i++)
        v.push_back(y[i]);

    return v;
}

int a[] = {4, 7, 5, 2, 3}, b[] = {15, 18, 25};
int aSize = sizeof(a)/sizeof(int), bSize = sizeof(b)/sizeof(int);
vector<int> va(a, a+aSize), vb(b, b+bSize), resultV;

resultV = f(va, vb);

resultV = _________________________________________
 




____________
Image
Image
Image
Offline Shiko profilin e anėtarit Dėrgo mesazh privat Vizito websitin e shkruesit Adresa e AIM Yahoo Messenger MSN Messenger Nr. i ICQ

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Re: Ushtrime Ne C++ 
 
agent0016 a kishe pas mundesi pak mi sqaru kto kode qe jan se psh un jam fillerstar ne gjuhen c++ dhe deshiroj ta mesoj po sipas ushtimeve tuaja qe ti i dha nuk po tham se jan te kqija met verteta sende te mira per me ushtru po un kodet spi kuptoj veq nese i mar copy/paste edhe opp e bera nje program...ktu eshte qellimi se ne si fillerstar se pari dojm te mesojm domethenjet e kodeve qe jan pastaj me hy ne ushtrime Very Happy  me fal ndoshta e teprova po ke nje mendim i imi i thejsht
 



Offline Shiko profilin e anėtarit Dėrgo mesazh privat

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Re: Ushtrime Ne C++ 
 
hotboy fillo me libra me mire se keshtu s'ke per ta marre vesh duke pare vetem code.
 



Offline Shiko profilin e anėtarit Dėrgo mesazh privat

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Re: Ushtrime Ne C++ 
 
teo ta tha mire, nuk mesohet kodi duke e pare dhe e shpjeguar, me pare duhet te dish nje pjese te vogel qe te mesosh nje me te madhe ;D
 




____________
Image
Image
Image
Offline Shiko profilin e anėtarit Dėrgo mesazh privat Vizito websitin e shkruesit Adresa e AIM Yahoo Messenger MSN Messenger Nr. i ICQ

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Re: Ushtrime ne C++ 
 
Keto kodet shume te komplikuar jane  Shocked
 




____________
Galeria Shqiptare Direktoria Shqiptare Kėrko nė Google
Offline Shiko profilin e anėtarit Shiko galėrinė personale tė anėtarit Dėrgo mesazh privat Vizito websitin e shkruesit Adresa e AIM Yahoo Messenger MSN Messenger Skype Nr. i ICQ

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Re: Ushtrime Ne C++ 
 
ckemi jz Very Happy

jane ca po ata qe kane punuar me c i kuptojne Very Happy
 




____________
Image
Image
Image
Offline Shiko profilin e anėtarit Dėrgo mesazh privat Vizito websitin e shkruesit Adresa e AIM Yahoo Messenger MSN Messenger Nr. i ICQ

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Re: Ushtrime Ne C++ 
 
ketu ke te drejte qe ata qe kane punuar me C i kuptojne por qe forumi te jete sa me ndihmues per vizitoret dhe anetaret, them se duhet te vendosen dhe shpjegimet.
Te pakten ato kryesoret.
Une psh. kete vitin qe kaloi fillova me perdor visual basic
ene me tho te drejten gjoja e pare qe na rekomanduan, ishte te perdornim komentet ne programim.
qe ne visual basic behen me nje apostrof para fjalise qe do te shkruash psh.
' ky eshte nje koment

ne fillim as une nuk para e ndiqja kete rregull por tani e kuptoj sa e rendesishme eshte se te gjithe ato prova qe kam bere duke shfletuar internetin apo duke mesuar ne shkolle, tani as vete se kuptoj se me cfare funksioni e kam lidhur nje kod. keshtu qe duhet te dergoj ne ekzekutim programin dhe te shoh lidhjet. OK  reading
 




____________
Image
Offline Shiko profilin e anėtarit Dėrgo mesazh privat Vizito websitin e shkruesit

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Disa Ushtrime Te Tjera 
 
///////////////////////////////////////////////////////////////////////
// File : Crammer.cpp
//
// Author: Sirjan X.
//
// Program Name: Crammer’s Rule
//
// Revision Number: 1.0
// Revision Date: 09/22/2007
// Module: Main
// Description:
//
//This program determines the value of x, and y through Crammer’s Rule    //given the value of the constants a, b, c, d, e, and f. The following //equations are used:
//
//
//    ;
//
//
//
// Revision History:
//   1.0: Original Code (09/22/2007)
///////////////////////////////////////////////////////////////////////////////

#include <iostream.h>

void main(void)
{
 float a; // symbol for the coefficient a
 float b; // symbol for the coefficient b
 float c; // symbol for the coefficient c
 float d; // symbol for the coefficient d
 float e; // symbol for the coefficient e
 float f; // symbol for the coefficient f
 float x; // symbol for the variable x
 float y; // symbol for the variable y
 
cout << "Please enter the values of the coefficient a,b,c,d,e, and f" << endl;
  cout << "for the following system of equations: " << endl;
  cout << " ax + by = c" << endl;
  cout << " dx + ey = f" << endl;
  
  cout << " Enter a = ";
  cin >> a;
  cout << " Enter b = ";
  cin >> b;
  cout << " Enter c = ";
  cin >> c;
  cout << " Enter d = ";
  cin >> d;
  cout << " Enter e = ";
  cin >> e;
  cout << " Enter f = ";
  cin >> f;
  
// Formula to calculate variables
  x = (c*e - f*b)/(a*e - b*d);
  y = (f*a - c*d)/(a*e - b*d);
  
  
  // displays results to the screen
  cout << "The value of x is: " << x << endl;
  cout << "The value of y is: " << y << endl;
 
 return;
}
 



Offline Shiko profilin e anėtarit Dėrgo mesazh privat

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Re: Ushtrime Ne C++ 
 
///////////////////////////////////////////////////////////////////////
// File : CarReg.cpp
//
// Author: Sirjan X.
//
// Program Name: NJ Car Registration Fee
//
// This program determines the registration fee and the weight class of a car // if you input the model year and the weight of that certain car into the //         // program.
//
//
///////////////////////////////////////////////////////////////////////////////

# include <iostream.h>
void main(void)
{
 float modelyear;  // model year of the vehicle
float weight;   // weight of the vehicle
 cout<<"Please enter the Model Year and the Weight of your vehicle"<<endl;
 cout<<"Enter Model Year = ";
 cin >> modelyear;
 cout<<"Enter Weight(lbs) = ";
 cin >> weight;
 if (modelyear <=1970 && weight < 2700)
  
  cout <<"The Weight Class of your vehicle is 1 and the Registration Fee is $16.50"<<endl;
 if (modelyear <=1970){
  
  if(weight>=2700 && weight <=3800)
  cout <<"The Weight Class of your vehicle is 2 and the Registration Fee is $25.50"<<endl;
 }
 if (modelyear <=1970 && weight > 3800)
  
  cout <<"The Weight Class of your vehicle is 3 and the Registration Fee is $46.50"<<endl;
 if (modelyear>=1971 && modelyear<=1979){
 if (weight <2700)
  cout <<"The Weight Class of your vehicle is 4 and the Registration Fee is $27.00"<<endl;
 }
 if (modelyear>=1971 && modelyear<=1979){
 if (weight >=2700 && weight <=3800)
  cout <<"The Weight Class of your vehicle is 5 and the Registration Fee is $30.50"<<endl;
 }
 if (modelyear>=1971 && modelyear<=1979){
 if (weight>3800)
  cout <<"The Weight Class of your vehicle is 6 and the Registration Fee is $52.50"<<endl;
 }
 if (modelyear >=1980){
  if (weight<3500)
  cout <<"The Weight Class of your vehicle is 7 and the Registration Fee is $19.50"<<endl;
 }
 if (modelyear >=1980){
  if (weight>=3500)
  cout <<"The Weight Class of your vehicle is 8 and the Registration Fee is $52.50"<<endl;
 }
}
 



Offline Shiko profilin e anėtarit Dėrgo mesazh privat

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Re: Ushtrime Ne C++ 
 
@agent0016

Une po e marr kete klase kete semester ne kolegj. Me behet qejfi qe qenka dikush ketu qe me kupton dhe ndofta mund edhe te shkembejme disa postime ndihmuse per njeri tjetrin.

Megjiathte ti dukesh shume i pergatitur sesa une.

Degjohemi se shpejti Wink
 



Offline Shiko profilin e anėtarit Dėrgo mesazh privat

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh Re: Re: Ushtrime Ne C++ 
 
agent0016 Shkruajti: [Shiko Temėn]
// Llogaritja e Sipėrfaqes dhe Perimetrit tė Rrethit

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


                    const double Pi = 3.141593;

                    void main(){
                    double siperfaqja, perimetri, r = 2.5;

                        siperfaqja = Pi * r * r;
                        perimetri = 2 * Pi * r;

                        cout << "\n LLOGARITJET per Rrethin\n" << endl;

                        cout << "Rrezja: " << r << endl
                        << "Siperfaqja: " << siperfaqja << endl
                        << "Perimetri: " << perimetri << endl;


                        getch();
                }/* <conio.h> dhe getch(); janė pėrdor pasi qė ėshtė pėrdorur Compiler-i i Borlandit pėr C  */


E NJEJTA GJE E BERE ME VISUAL BASIC

Sub Form_Load()
'Llogaritja e Sipėrfaqes dhe Perimetrit tė Rrethit
dim rrezja as integer
dim siperfaqja as double
dim perimetri as double
Const pg=3.141593 'deklarim vlere konstante


rrezja=inputbox("vendos vleren e rrezes se rrethit")
siperfaqja=rrezja*rrezja*pg
perimetri= rrezja*2*pg

Msgbox(" siperfaqja e rrethit eshte "+str(siperfaqja)+vbnewline+"Perimetri i rrethit eshte: " + str(perimetri))
end sub
 




____________
Image
Offline Shiko profilin e anėtarit Dėrgo mesazh privat Vizito websitin e shkruesit

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh RE: Numrat E Telefonave!!! 
 
HI! A mund dikush tem ndihmoj ketu se se di zgjidhejn !!! E pata ne provim por nuk e dija dhe nese dikush e ben le ta beje me komente ok!!!  Ne C++ natyrisht. Detyra thot Keshtu:
   DY DJEM I KANE KERKUAR NUMRA E TELEFONAVE TE DY VAJZAVE. vAJZAT U KANE THENE SE NUMRAT E TYRE JANE GJASHTESHIFRORE (abcdef) DHE SECILI NR.TELEFONIK ESHTE I BARABARTE ME KATRORIN E SHUMES SE DY NUMRAVE TRESHIFRORE TE FORMUAR NGA 3 SHIFRAT E PARA DHE 3 SHIFRAT E FUNDIT TE TIJ.  CILET JANE NUMRAT TELEFONIK TE DY VAJZAVE?!!! Ju lutem ndihmoni!!! Vetem nese mundet me komente!!!! Ju Lutem!!! FLM!!!! Laughing
 



Offline Shiko profilin e anėtarit Dėrgo mesazh privat

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh RE: C++ Ushtrime!!! 
 
Detyra eshte: Shkruani program i cili e ben numerimin e kundert psh.  per numrin 10 numerimi duket keshtu : 10 9 8 7 6 5 4 3 2 1 0.

#include <iostream.h>
using namespace std;
int main ()
{
for (int i=10; i>0; i--) {
cout << i << "\n\n\n\n" << endl;
}
cout << "\n**************HAPPY  NEW  YEAR******************\n\n" << "\n\n****************2008***************\n\n" << endl;
system ("PAUSE");
return 0;
}

 



Offline Shiko profilin e anėtarit Dėrgo mesazh privat

Pėrgjigju me kuotė Shkarko Mesazhin
Mesazh RE: C++ Ushtrime!!! 
 
Kjo eshte nje script per ata qe duan te mesojn me shum dhe qe e kuptojn gjuhen Croate!!!
 



Offline Shiko profilin e anėtarit Dėrgo mesazh privat
Shfaq mesazhet nga:
Shuma e Votimeve:
Vlerėsim Mesatar Vlerėsim Minimal Vlerėsim Maksimal Numri Vlerėsimeve
0.00 0 0 0
Shiko info tė Detajuar
Zgjidh Vlerėsimin: 
Posto temė tė re Pėrgjigju temės  Faqja 2 e 2
Shko tek faqja E mėparshme  1, 2

Pėrdorues duke shfletuar temėn: 0 anėtarė 0 tė fshehur 0 vizitorė
Anėtarėt e regjistruar Asnjė





  

   

Version i Thjeshtuar

Lexo lajmet e fundit nepermjet Goolge Te rejat e fundit ne Kaltersia Shqiptare Lexo lajmet e fundit nepermjet Yahoo!