cikara21 37 Posting Whiz

here's a simple sample code...
i don't test it yet :)...
let me know the result...

void push_back(mp3Type **p_type, int _id, string _sTitle, string _artist, string _length, string _size)
{
       mp3Type *p = new mp3Type;
       if (&p == NULL)
           return;
       p->id = _id;
       p->songTitle = _sTitle;
       p->artist = _artist;
       p->length = _length;
       p->size = _size;
       p->next = *p_type;
       *p_type = p;
} 

void delete(mp3Type *p_type, mp3Type **ret_Type)
{
       mp3Type *t, *n;
       t = p_type;
       int id = 0;
       cout<<"Enter song ID that you like to delete"<<endl;
       cout<<endl;
       cin>>id;
       while (t != NULL)
       {
             if (t->id == id)
             {
                   t = t->next;
                   continue; //-- pass
             }
             int t_id = t->id;
             string t_sTitle = t->songTitle;
             string t_artist = t->artist;
             string t_length = t->length;
             string t_size = t->size;
             push_back(&n,t_id,t_sTitle,t_artist,t_length,t_size);
             t = t->next;  
       }
       *ret_Type = n;
}

//--
//-- To call delete
//-- mp3Type *main_Type, *temp_Type;
//-- delete(main_Type, &temp_Type);
//--
cikara21 37 Posting Whiz

How about this

//...With original code
salary = (dailyPay*days)*2;
//...
cikara21 37 Posting Whiz
// example
int func(void)
{
   int i=0;
   return i; // return value
}
cikara21 37 Posting Whiz

Yup..Last In First Out..

cikara21 37 Posting Whiz

Neither do i..Detail please..

cikara21 37 Posting Whiz

Remove
'#include "stack.cpp"' at stack.h file..
Add
'#include "stack.h"'
to your stack.cpp file..

cikara21 37 Posting Whiz

Here's a ex. that may help you..

// add this method
void Inventory::Push(Part **p_part,int _num,float _price)
{
   Part *p=new Part;
   if (p==NULL)
      return;
   p->number=_num;
   p->price=_price;
   p->next=*p_part;
   *p_part=p;
}

void Inventory::printDescending(void)
{
   Part *travel,*dummy;
   dummy=start;
   while(dummy!=NULL)
   {
      int n=dummy->number;
      float p=dummy->price;
      Push(&travel,n,p);
      dummy=dummy->next;
   }

   while(travel!=NULL)
   {
      std::cout<<travel->number<<'\t'<<travel->price<<std::endl; 
      travel=travel->next;
   }
}
cikara21 37 Posting Whiz

Here's a ex. that may help you..

// add this method void Inventory::Push(Part **p_part,int _num,float _price) { Part *p=new Part; if (p==NULL) return; p->number=_num; p->price=_price; p->next=*p_part; *p_part=p; }

void Inventory::printDescending(void) { Part *travel,*dummy; dummy=start; while(dummy!=NULL) { int n=dummy->number; float p=dummy->price; Push(&travel,n,p); dummy=dummy->next; }

while(travel!=NULL) { std::cout<<travel->number<<'\t'<<travel->price<<std::endl; travel=travel->next; } }[code=c++]
// add this method
void Inventory::Push(Part **p_part,int _num,float _price)
{
Part *p=new Part;
if (p==NULL)
return;
p->number=_num;
p->price=_price;
p->next=*p_part;
*p_part=p;
}

void Inventory::printDescending(void)
{
Part *travel,*dummy;
dummy=start;
while(dummy!=NULL)
{
int n=dummy->number;
float p=dummy->price;
Push(&travel,n,p);
dummy=dummy->next;
}

while(travel!=NULL)
{
std::cout<<travel->number<<'\t'<<travel->price<<std::endl;
travel=travel->next;
}
}

cikara21 37 Posting Whiz

Yes you have..On compiler properties/settings page..Sorry for my bad English..

cikara21 37 Posting Whiz
window(10,10,77,77);
// never use it
cikara21 37 Posting Whiz

Add your lib. path as additional include directory..

cikara21 37 Posting Whiz

Where is the "add part" codes..Have you enchance the items into item list..

cikara21 37 Posting Whiz

Try this..

// ... palindrome.h
static void palindrome(int i_var)
{
    // your code
}
// ...
cikara21 37 Posting Whiz
#include <iostream.h>
#include <fstream.h>
//...
char filename[255];
ifstream infile;
cout<<"File name : ";
cin.getline(filename,255);
infile.open(filename);
//...
cikara21 37 Posting Whiz

Use static before __declspec...first lib.!...

cikara21 37 Posting Whiz
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;

// Declaring prototypes

void displayWelcome();
double correctCost(double);
double getMarkUp(string);
void calculateRetailPrice(int, double, double, double &, double &,
double &);
void displayResults(string, int, double, double, double, double, double);

int main ()
{
     // Declaring variables
     int quantity = 0;
     double wholeSaleCost = 0, percMarkUp = 0;
     double amountMarkUp= 0, salesTax = 0, retailPrice = 0;
     string item;

     displayWelcome();

     cin >> item;
     cin >> quantity;
     cin >> wholeSaleCost;

     cout << "\n" <<endl;
     cout << "Item Name Quantity      ";
     cout << setw(15) << "Unit Price";
     cout << setw(15) << "Markup %";
     cout << setw(15) << "Markup";
     cout << setw(12) << "Tax";
     cout << setw(20) << "Retail Price";
     cout << endl;

     // Loop with Sentinel value

     while(item != "Done" && quantity != 0 && wholeSaleCost != 0)
     {
          // Less than 1000 test

          if (wholeSaleCost > 1000)
          {
               wholeSaleCost = correctCost(wholeSaleCost);
          }

          percMarkUp = getMarkUp(item);

          calculateRetailPrice(quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);

          displayResults(item, quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);

          cin >> item;
          cin >> quantity;
          cin >> wholeSaleCost;
     }
     return 0;
}



void displayWelcome ()
{
     cout << "*****************************************************************"<<e$
     cout <<"* Welcome to ABX. I am Alete, your manager. *" <<endl;
     cout <<"* Here is a summary of your purchases. *" <<endl;
     cout << "****************************************************************"<<en$
}
double correctCost (double wholeSaleCost)
{
     return wholeSaleCost / 100;
}
double getMarkUp(string item)
{
     double percent;
     if (item == "Bracelet" || item == "Earrings")
     percent = 1;
     else if (item == "Necklace")
     percent = .3;
     else if …
cikara21 37 Posting Whiz
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;

// Declaring prototypes

void displayWelcome();
double correctCost(double);
double getMarkUp(string);
void calculateRetailPrice(int, double, double, double &, double &,
double &);
void displayResults(string, int, double, double, double, double, double);

int main ()
{
     // Declaring variables
     int quantity = 0;
     double wholeSaleCost = 0, percMarkUp = 0;
     double amountMarkUp= 0, salesTax = 0, retailPrice = 0;
     string item;

     displayWelcome();

     cin >> item;
     cin >> quantity;
     cin >> wholeSaleCost;

     cout << "\n" <<endl;
     cout << "Item Name Quantity      ";
     cout << setw(15) << "Unit Price";
     cout << setw(15) << "Markup %";
     cout << setw(15) << "Markup";
     cout << setw(12) << "Tax";
     cout << setw(20) << "Retail Price";
     cout << endl;

     // Loop with Sentinel value

     while(item != "Done" && quantity != 0 && wholeSaleCost != 0)
     {
          // Less than 1000 test

          if (wholeSaleCost > 1000)
          {
               wholeSaleCost = correctCost(wholeSaleCost);
          }

          percMarkUp = getMarkUp(item);

          calculateRetailPrice(quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);

          displayResults(item, quantity, wholeSaleCost, percMarkUp,
amountMarkUp, salesTax, retailPrice);

          cin >> item;
          cin >> quantity;
          cin >> wholeSaleCost;
     }
     return 0;
}

void displayWelcome ()
{
     cout << "*****************************************************************"<<e$
     cout <<"* Welcome to ABX. I am Alete, your manager. *" <<endl;
     cout <<"* Here is a summary of your purchases. *" <<endl;
     cout << "****************************************************************"<<en$
}
double correctCost (double wholeSaleCost)
{
     return wholeSaleCost / 100;
}
double getMarkUp(string item)
{
     double percent;
     if (item == "Bracelet" || item == "Earrings")
     percent = 1;
     else if (item == "Necklace")
     percent = .3;
     else if …
cikara21 37 Posting Whiz
int random (int num)
{

srand (time (NULL));
num = rand();
cout << num << endl;

if (num != 0)
return random(num % 10);
num = num / 10;
}
cikara21 37 Posting Whiz
//...
flush(stdin);
operation = (bit)(getchar() == (int)'+');
//...
cikara21 37 Posting Whiz

Sedikit informasi...
Semoga dapat membantu

#ifndef _MSC_VER
#include <string.h>
#else
#include <string>
#endif

//.....
cikara21 37 Posting Whiz

Use reinterpret_cast or c style cast to casting..
But the matrix will become 1 dimension matrix..

#include <iostream>

void func(int **);

int main(int argc,char *argv[])
{
    int A[2][2]={1,2,3,4};
//--reinterpret_cast
      func(reinterpret_cast<int**>(A));
//--c style cast
      func((int**)A);   //--func(A);
}
void func(int **A)
{
}

Best,
Pradeep

cikara21 37 Posting Whiz
#include <stdio.h>

int main()
{
    int toonie, dollar, quarter, dime, nickel, cent;  
    float amount, change, cchange;
    char ch='Y', N, Y;
    
    while(ch=='Y'){
    //-- init / reinit
    toonie = 0; dollar = 0; quarter = 0; dime = 0; nickel = 0; cent = 0;
    printf("\n Your total is $", amount);
    scanf(" %f", &amount);
    
    change=(5.00-amount);
    printf("\n Your change is $%3.2f\n", change);
    while(change>=0 && change<5.00){
    cchange=(change*100);
    while (cchange>=200){
        cchange-=200;
        toonie++;
        }
    while (cchange>=100){
        cchange-=100;
        dollar++;
        }
    while (cchange>=25){
        cchange-=25;
        quarter++;
        }
    while (cchange>=10){
        cchange-=10;
        dime++;
        }
    while (cchange>=5){
        cchange-=5;
        nickel++;
        }
    while(cchange>=1){
        cchange-=1;           
        cent++;
        }
        
       // print results
       printf(" You have %d coins of 2 dollars \n", toonie);
       printf(" You have %d coins of 1 dollar \n", dollar);
       printf(" You have %d coins of 25 cents \n", quarter);
       printf(" You have %d coins of 10 cents \n", dime);
       printf(" You have %d coins of 5 cents \n", nickel);
       printf(" You have %d coins of 1 cent \n", cent);
       break;
       } // end while
       
       printf("\n Do you want to try again? (Y/N)\n\n");
       ch=toupper(getche());
       
       } // end while
       getch();
       
       }
cikara21 37 Posting Whiz

thanks...

//....
      if(isspace(input[charPosition])
      //--or input[charPosition] == char(/*decimal number for space*/)
      && input[charPosition] <= '@')
      {
      intVal = input[charPosition] + 0;
      character = char(intVal);
      finalText = finalText + character;
      }
      //....
cikara21 37 Posting Whiz

1. nop..
(char) max size = 16 bit
(int) max size = 32 bit
(__intn) max size = 8,16,32,64 bit
(float) max size = 32 bit

2. use static for global variable or global function

static int a = 10;
static void do_something(void);
cikara21 37 Posting Whiz
//--------------------------------------

int A[2][2]={1,2,3,4}; //--overflow
func(A);

//--------------------------------------

int A[1][4];
A[0][0] = 1;
A[0][1] = 2;
A[0][3] = 3;
A[0][4] = 4;

//--------------------------------------
cikara21 37 Posting Whiz
//....
if(isspace(input[charPosition]))
//--or input[charPosition] == char(/*decimal number for space*/) 
&& input[charPosition] <= '@')
		{
			intVal = input[charPosition] + 0;
			character = char(intVal);
			finalText = finalText + character;
		}
//....
cikara21 37 Posting Whiz
//...maybe this impl. can help

[DllImport("./MXFWrapperMarvel.dll", EntryPoint = "add")]
static extern int APIENTRY add(int a, int b);
//...
cikara21 37 Posting Whiz
int main ()
{
        double num = 0.0, sum = 0.0, average=0.0; 

        cout << "Enter a value -99 to end:"; 
        cin >> num; 

        while (num != -99)
        {
                sum = sum + num; 
                average = sum/num; 

                cout << "The average is:" << setprecision (2) << (double)average << endl << endl; 

                cout << "Enter another value -99 to end:"; 
                cin >> num; 
        }
        return 0; 
}
cikara21 37 Posting Whiz
//--
cikara21 37 Posting Whiz
void initialize (ifstream& soda, ifstream& coin, SodaMachine* soda_machine)
{    
     string coin_line;    
     char coin_type;    
     char temp_char;   
     int num_coins;    
     //do  
     //{   
           //Read in line from file   
           coin >> coin_type;    
           //Check to make sure coin_type is a valid type   
           switch (coin_type)   
          {         
               case 'Q':           
                     coin_type = 'q';// remove this if you don't need it      
               //--remove  break;        
               case 'q':             
                      coin >> temp_char;           
                      if (temp_char==':')            
                      {                
                             coin >> num_coins;                
                             if (num_coins >= 0)                
                             {                    
                                   soda_machine->quarters=num_coins;                
                             }                
                             else                
                             {                   
                                   //num_coins is less than 0 or soda failed                
                             }      
                      }
                      else            
                      {
                              //Second character was not a colon            
                      }            
                      break;        
                case 'D':            
                      coin_type = 'd';// remove this if you don't need it       
                      //--remove break;        
                case 'd':             
                      coin >> temp_char;            
                      if (temp_char==':')            
                      {                
                             coin >> num_coins;                 
                             if (num_coins >= 0)                
                             {                    
                                    soda_machine->dimes=num_coins;                
                             }                
                             else                
                             {                    
                                    //num_coins is less than 0 or soda.cin failed                
                             }               
                      }            
                      else            
                      {                
                             //Second character was not a colon            
                      }            
                      break;        
                case 'N':            
                      coin_type = 'n';// remove this if you don't need it   
                      //--remove break;        
                case 'n':             
                      coin >> temp_char;            
                      if (temp_char==':')            
                      {                 
                            coin >> num_coins;                 
                            if (num_coins >= 0)                
                            {                    
                                    soda_machine->nickels=num_coins;                
                            }                
                            else                
                            {                    
                                    //num_coins is less than 0                 
                            }               
                      }            
                      else            
                      {                
                            //Second character was not a colon            
                      }            
                      break;        
                 case '@': 
                      //should be default            
                      //First letter in line is not Q, q, D, d, N, or n            
                      break;    
              }
        //}while (coin);
}
cikara21 37 Posting Whiz

it's out of range...

cikara21 37 Posting Whiz

your code :

dynamicarray = new char(Size([20]);

my code :

...
dynamicarray = new char(Size([20])); // <-- ???
//--or
dynamicarray = new char(Size(20));
//--or
dynamicarray = new char[20];
cikara21 37 Posting Whiz
#define NULL 0
....
while((tmp&0xc0) != NULL)
{
        printf("11xx-xxxx bits of chr[%d]=%x\n",i,tmp&0xc0); //extract 1100 0000    
        tmp = tmp<<2;
}
cikara21 37 Posting Whiz

maybe this can help...vote me...

// constructor
Employee::Employee( int eID) : setEmployeeID( eID )
{
   // :-) 
}
cikara21 37 Posting Whiz
// call :

system("pause"); // ||  system(pause);

// maybe..
cikara21 37 Posting Whiz
#include <iostream>
#include <conio>
using namespace std;
//Function prototype
void getscore(int, int, int, int, int);
 
int main()
{
        int score1, score2, score3, score4, score5;
        //===== 
        for (unsigned int i=0;i<5;i++)
        {
        cout << "Enter your five test scores: ";     
        if (i==0)
             cin  >> score1; // cin >> score[i];
        else if (i==1)
             cin >> score2 ;
        else if (i==2)
             cin >> score3 ;
        else if (i==3)
             cin >> score4;
        else if (i==4)
             cin  >> score5;
        }
        //============
        // or use array of int
        // int score[5];
        // ...
        // cin >> score[i];

        getscore (score1, score2, score3, score4, score5) <<endl;
        getch();
        return 0;
}
void getscore(int score1, int score2, int score3, int score4, int score5)
{
        cout << "Your five test scores are:\n";
        cout << score1 <<endl;
        cout << score2 <<endl;
        cout << score3 <<endl;
        cout << score4 <<endl;
        cout << score5 <<endl;
}
cikara21 37 Posting Whiz

remove:
static int16_t buffer_out[buf_size];

change into:
int16_t buffer_out[buf_size];

.......he..he

cikara21 37 Posting Whiz

remove the stars at line :

107
125

etc...

cikara21 37 Posting Whiz

Change the private constructor into a public constructor..

.....???

cikara21 37 Posting Whiz

//example :
...........

class quizz
{
        private:
             string question1;
        // ..........
        public:
             quizz()
             {
                  question1 = "what is the net";
             }
             void outA()
             {
                   std::cout<<question1
                   <<std::endl;
             }
             // ...............
};

// you can try it..