cikara21 37 Posting Whiz

Ask the author..

Salem commented: Seems like a good place to start to me, rather than a bunch of joes on a random website. +23
cikara21 37 Posting Whiz

Here u go..

int a[2]={1,2};
int b[2];
for(size_t i=0;i<2;i++)
   b[i]=a[i];
cikara21 37 Posting Whiz
void DisplaySalsa(string salsa[], int numsold[])
{
  cout<<"Salsa Type      Jars Sold " <<endl;

  for (int k=0; k<max; k++)
     {
     cout<<"salsa["<<k<<"] = "<<salsa[k]<<endl;
     cout<<"numsold["<<k<<"] = "<<numsold[k]<<endl;
     }
}
cikara21 37 Posting Whiz

Here..

virtual void CSample1::Sample(SysString str)
(
   if(str.empty())
      return;
   //...
)
virtual void CSample2::Sample(SysString &str)
{
   str="what's up";
}
int main()
{
   SysString str1="check";
   SysString str2;
   CSample1 s1;
   CSample2 s2;
   s1.Sample(str1);
   s2.Sample(str2);
   return 0; 
}
cikara21 37 Posting Whiz

Like this..

current_deg
current_min
current_sec
 
if(current_sec >= 60) then
begin
   current_min++
   current_sec=(current_sec-60)
end

if(current_min>=60) then
begin
   current_deg++
   current_min=(current_min-60)
end
cikara21 37 Posting Whiz
/* Filename: odometer.cpp
 * Author: Tom Pizzo
 * Email address: pizzotm@clarkson.edu
 * Description: Program to track fuel and mileage for an automotive vehicle.
 * Last changed: Dec 1, 2008
 */

#include <iostream>

using namespace std;

const char YES = 'y';

class Odometer {

public:
  Odometer ();
  //Constructor function to initialize values to zero.

  void  input();
  //Recieves input from user.
  void set_mile (double &new_miles, double &new_fuel);
  //resets Fuel and miles according to arguments.
  void set_odo(double &temp_odometer);

  void output(double gas_burned);
  //Displays how much gas is burned from the input of the user.

  void get_fuel_efficiency(double temp_odometer,double new_miles, double& gas_burned);

  double add_to_odometer(double &temp_odometer, double new_miles );
  //Takes miles driven on the trip and adds them to the odometer.
  char play_again(char y_or_n);
  //Prompts user to enter another trip.
  double reset_odo(double &temp_odometer, char reset_variable);
  //Prompts user to reset odometer or not.


private:

  double miles_driven;
  double fuel_efficiency;
  double odometer;

};

int main (){

  Odometer trip;
  char y_or_n;
  char variable,reset_variable;
  double gas_burned;
  double new_miles,new_fuel,temp_odometer,new_odo;

  do{

    trip.input();
    trip.set_mile(new_miles,new_fuel);
    trip.set_odo(temp_odometer);
    //trip.add_to_odometer(new_miles,temp_odometer);
    trip.get_fuel_efficiency(temp_odometer,new_fuel,gas_burned);
    trip.output(gas_burned);
    variable = trip.play_again(y_or_n);

    if (variable == YES){
      trip.reset_odo(temp_odometer,reset_variable);

    }


  }while(variable == YES);

  return 0;

}

//Function definitions.

Odometer::Odometer() {

  miles_driven = 0.0;
  fuel_efficiency = 0.0;
  odometer = 0.0;
return;

}

void Odometer::input(){
  using namespace std;

  cout << "Tell me about your trip!";
  cout << "\nFuel efficiency(MPG)?";

  cin >> fuel_efficiency;

  cout << "\nMiles driven?";

  cin >> miles_driven;
  return;

}

void Odometer::set_mile(double &new_miles, double &new_fuel){

  new_miles=miles_driven;
  new_fuel=fuel_efficiency;
}

void Odometer::set_odo(double &temp_odometer){

  std::cout<<"Set new odo, please! : ";
  cin>>odometer;
  temp_odometer = odometer;


}
double Odometer::add_to_odometer(double &temp_odometer,double new_miles){

  temp_odometer = …
cikara21 37 Posting Whiz

When?...

cikara21 37 Posting Whiz

AB...???

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main(void)
{
int N, M, R, S;
printf("\nPlease enter N\n");
scanf ("%d", &N);
fflush(stdin);
printf("\nPLease enter  M\n");
scanf ("%d", &M);
R=(N-(M*(N/M)));
if(R > 0)
{
   S=(M-(M*(M/R)));
   printf("S = %d\n",S);
}
printf("R = %d\n",R);

//this is AB..
int AB=(M*(M-(M*(M/R))));
printf("AB = %d\n",AB);
system("pause");
return(0);
}
cikara21 37 Posting Whiz
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main(void)
{
int N, M, R, S;
printf("\nPlease enter N\n");
scanf ("%d", &N);
printf("\nPLease enter  M\n");
scanf ("%d", &M);
R=(N-(M*(N/M)));
if(R > 0)
{
   S=(M-(M*(M/R)));
   printf("S = %d\n",S);
}
printf("R = %d\n",R);
int AB=(M*(M-(M*(M/R))));
printf("AB = %d\n",AB);
system("pause");
return(0);
}
cikara21 37 Posting Whiz

Just call this..

bool sample::exist(NodePtr *p,int age)
{
   bool isexist=false;
   NodePtr *n_ptr = p;
   for(;n_ptr!=0;n_ptr=n_ptr->Next)
      if(n_ptr->Info.Age==age)
         isexist=true;
   return isexist;
)
cikara21 37 Posting Whiz

> I'll do it for $500.
> I'll do it for $5000.

I'll do it for $5005..

cikara21 37 Posting Whiz
double x=a-((2*(com/1000))+b);
cikara21 37 Posting Whiz

Try..

strlen(article[0]); //or
getSize(article[0]); //???
cikara21 37 Posting Whiz

The question is..Find them..
Got one, nah two, annnnd...another one!..
Here u go..

1. double num_one, ...;
2. char ans;
3. average = (...)/8;
cikara21 37 Posting Whiz

Means..
n=0, m=0
1. if Buffer[n] = 'null' then stop
2. if Buffer[n] = 'space' then n = n + 1, m = m + 1, back to step 1
3. m = m + 1
4. Buffer[n] = Buffer[m], back to step 1

cikara21 37 Posting Whiz

Another corrections..

//cin>>firstName;
cin.getline(firstName,30);
//cin>>lastName;
cin.getline(lastName,30);
//cin>>NID;
cin.getline(NID,30);
cikara21 37 Posting Whiz

Compiler menu..Click Project->(prj name)properties..And then click Configuration Properties->C/C++->Precompiled Header..
Create/Use PH..Change it..

cikara21 37 Posting Whiz

Check the size..

int i=0;
string aWord = "abcdf!";

while(aWord[i])
{
   if(isalpha(aWord[i]))
      printf ("character %c is alphabetic\n",aWord[i]);
   else
   {
	aWord.erase (i, 1);
      //..Is idx > length
       if(i>aWord.size())
          break;
       i--;
   }
   i++;
}
cout<<aWord;
cikara21 37 Posting Whiz

Here's a sample code..The rest is yours..

void swap(int items[], int i1, int i2)
(
   int t = 0;
   t=items[i1];
   items[i1]=items[i2];
   items[i2]=t;
)
int main()
{
   int n=0,m=0;
   const int s=4;
   int num[s]={4,1,2,3};
   int old[s]={4,1,2,3};

   for(;n<s;n++)
      std::cout<<num[n]<<std::endl;
   for(n=s-1;n>0;n--)
      for(m=0;m<n;m++)
         if(num[m]>num[m+1])
            swap(num,m,m+1);
   
   std::cout<<std::endl;
   for(n=0;n<s;n++)
      std::cout<<num[n]<<std::endl;

   //...A few aid
   for x=0 to s-1
      for y=0 to s-1
         if num[x] = old[y] then
             the old pos=y

   return 0;
 //done
}
cikara21 37 Posting Whiz

Here's a sample code..The rest is yours..

void swap(int items[], int i1, int i2)
(
   int t = 0;
   t=items[i1];
   items[i1]=items[i2];
   items[i2]=t;
)
int main()
{
   int n=0,m=0;
   const int s=4;
   int num[s]={4,1,2,3};
   for(;n<s;n++)
      std::cout<<num[n]<<std::endl;
   for(n=s-1;n>0;n--)
      for(m=0;m<n;m++)
         if(num[m]>num[m+1])
            swap(num,m,m+1);
   num[s-1]=0;
   std::cout<<std::endl;
   for(n=0;n<s;n++)
      std::cout<<num[n]<<std::endl;
   return 0;
}
cikara21 37 Posting Whiz

Don't waste a time and traffic on this funny "problems"...

:) .. :)

cikara21 37 Posting Whiz

Maybe IClassFact is a reference class only..

cikara21 37 Posting Whiz

Simply..

//...
char rep='n';
//display the menu and get user's choice
while(tolower(rep)=='n')
{
    //...Menu
    cout<<"repeat? [y/n] : ";
    cin>>rep;
}
return 0; //bye..
cikara21 37 Posting Whiz

???!..C++ is case-sensitive..Am i rite?..

cikara21 37 Posting Whiz
//...
bool repeat=false;
do{
   //...
   switch(cho){
   default:
      //...Bad input
      repeat=true;}
}while(repeat);
cikara21 37 Posting Whiz

Is this what u need..

template<class T>class X
{
   class Y
   {
      public:
      //...Declare it first
      Y *operator[](int);
   }
   //...
}
template<class T>typename
X<T>::Y *X<T>::Y::operator[](int idx)
{
   //blahblah
}
cikara21 37 Posting Whiz

I dont see a problem too..As long as u returned the rite type..

cikara21 37 Posting Whiz

X is....

#define X -1
#define O 1

rite!!....

StuXYZ commented: well spotted (#define) -- pure evil. +1
cikara21 37 Posting Whiz

i dont know what to say...so...

void Board1(int board1[5][5])
{
	cout << endl;
   
   for (int row=0; row<5; row++)
   {
      for (int col=0; col<5; col++)
      {
         cout << "| ";
         if (board1[row][col] == 0) cout << " ";
         else if (board1[row][col] == -1) cout << "X";
         else if (board1[row][col] == 1) cout << "O";
      }
      cout << "\n-------------" << endl;
   }
}
cikara21 37 Posting Whiz

Bacause there is no loops...

cikara21 37 Posting Whiz

Missing ',' huh....
see this..

void Blackjack::InitDeck(Card deck[] int numCards)
{
     //...
}
cikara21 37 Posting Whiz

node...change it to NodeType..
then give me some error message

cikara21 37 Posting Whiz

see main body...

push(...); //see this, there is no global function named push. it is a class member function, what's wrong with you..
x.push(...); // this, this, this...????
cikara21 37 Posting Whiz
1. void stack::reverse(node* ptr) // node ???
    //--
    void stack::reverse(NodeType* ptr) 
2. class stack
   {
        private:
             NodeType* topPtr;
        public:
	
	     stack();
	     void push(ItemType);         // see this
	     int pop();
	     bool isempty();
	     bool isfull();
	     void print();
	     void print_reverse(stack);
	     void reverse(node)
	     void push(ItemType);              // and this
    };
3. node,??? maybe NodeType
4. push(...), there is no global function named push...
    maybe, x.push(...).
5. isfull(...), ??? maybe x.isfull(...).
6. print_reverse(...), ???? maybe x.print_reverse(...).
cikara21 37 Posting Whiz

You did not flush the std input buffer..Just think..

cikara21 37 Posting Whiz

Just a sample..Easy way!!..

// member of TreeofWords
static int size=0;
void TreeofWords::setsize()
{
   size++;
}
int TreeofWords::getsize()
{return size;}

void main()
{
   // ...
   while(file>>word)
   {
      display.setsize();
      // ...
   }
   std::cout<<"freak word count : "<<display.getsize();
   // ...
}// done
cikara21 37 Posting Whiz

The owner of the problem..Not u..Sorry..

cikara21 37 Posting Whiz

I'am sure there is an error..Not only failed to display the freakword count..

cikara21 37 Posting Whiz
//...
if (ch < 'a' && ch > 'z')
    //...Do you understand this?
freelancelote commented: Thanks (I feel embarrassed for my mistake) +1
cikara21 37 Posting Whiz
if (choice == 'y')
   // ...
cikara21 37 Posting Whiz

It's same way..Learn from first problem..

cikara21 37 Posting Whiz

Do not need

#include<QtGui.h>

at Ghost.h

cikara21 37 Posting Whiz

Yep, i know..You declare print_reverse as a global function too..
Should be..

void stack::print_reverse(int i)
cikara21 37 Posting Whiz

What about..this...

//...
fin.open(ifile);
if(fin.fail())
   std::cout<<"does not exist";
//...
cikara21 37 Posting Whiz

Here..this is a function..

int f_i(int x,int y)
   {
      //...
      return (x+y);
   }
   // you meant 
   // z = f_i(...,...)!!
cikara21 37 Posting Whiz

I think the codes was OK, but not secure yet..

cikara21 37 Posting Whiz

If failed to open..

if (fin.fail())
   cout<<"file does not exist";
cikara21 37 Posting Whiz

Path for input and output..Isn't it same?..

cikara21 37 Posting Whiz
void print_reverse(int i)
{
   if(i<MAX && i >= 0)
   {
         cout<<st[i]<<endl;

         print_reverse(--i);
   }
}

for saving, declare ofstream outstream as a class member..

// main
print_reverse(MAX-1);
// ...
cikara21 37 Posting Whiz
void print_reverse(int i)
{
   //if(i<MAX)
   //{
      ofstream out;
      out.open("output.txt");
      // not recommended
      for(int j=9;j>=0;j--)
      {
         cout<<st[j];
         out<<st[j];
      }
      out.close();
   //}
}