Hello,

Well, not long ago i've been given a worksheet at school since I wanted to get into software development to achieve small games and useful programs. The worksheet is really simple and i've learned quite a bit on basics but I still need help.

This is what I could achieve with my knowledge;

#include <iostream.h>
/*Worksheet I
30 of July
Michel
Complete additions*/

int main ()
{
int num1, num2, num3, suma, prom, prod; // declarations of variable

cout << "Insert the first number/n";
cin >> num1;
cout << "Insert the second number/n";
cin >> num2;
cout << "Insert the third number/n";
cin >> num3;

sum = num1 + num2 + num3;
prom = (num1 + num2 + num3)/3;
prod = num1 * num2 * num3;

cout << " The addition of " <<num1 << " , " <<num2 << " and " <<num3 << " is " <<sum << endl;
cout << " The overall of " <<num1 << " , " <<num2 << " and " <<num3 << " is " << prom << endl;
cout << " The product of : <<num1 << " , " <<num2 << " and " <<num3 << " is " << prod << endl;

reutn 0;
}

This is a small calculator I made for question 1 - 2 of the worksheet (it is in Spanish so i'm sorry for work translation).

At this point, its were I go blank, I need help on a couple of things which will really help me get going quick!

- A program that draws a rectangular rectangle using 6 asterixes (*) in its base
- A program that determines if a number is pair or odd (using operator module)
- " " if the largest number inserted is a multiple of the small one (using two numbers).

Since im on a Windows and the script is on a Mac, I had to copy it. I use Xcode as software for C++.

Michel
Thanks,

I don't know what your question is, or even if you have one. But this line is wrong:
>>#include <iostream.h>


Current c++ standards do not use the .h extension. So if you use a modern compiler than code it like this: #include <iostream>

Im sorry, I pressed space and submitted without finishing but the question is asked there,

Thanks,

- A program that draws a rectangular rectangle using 6 asterixes (*) in its base
- A program that determines if a number is pair or odd (using operator module)
- " " if the largest number inserted is a multiple of the small one (using two numbers).

Those look like three different programs, so I would write them as separate programs instead of trying to put them all in the same program.

Yes, those are three seperate softwares that I need help on,

* The triangle with asterixes is solved, I got up with my friends and could figure it out.

But I still need help on a software that when you insert a number, it determines if it is odd or pair and i've been told as tip to use operator module. And a software that when a couple of numbers are inserted, it determines if the largest number is a multiple of the small one (ej. 6 - 2 <yes>, 9 - 4 <no>).

Thanks,

Post your attempt(s) to solve the problems.

I would if I had any, its my actual first day of software programming, so I dont really know how to achieve things, this is basically why I ask help... but the only thing i've managed to find out is that there is a special key I must use, the %, can someone help me with that?

I would if I had any, its my actual first day of software programming, so I dont really know how to achieve things, this is basically why I ask help... but the only thing i've managed to find out is that there is a special key I must use, the %, can someone help me with that?

If you do 4 % 2 then it is 0, if you do 5 % 2 it is one, for example. That should help you

Ok, thanks I could figure this out, thanks again ace!

Ok, thanks I could figure this out, thanks again ace!

No problem

Hi Michel,

Here are the solutions you were looking for.

1) Rectangular Triangle:

#include<iostream.h>
#define N 6
/* Worksheet II
 31th July,2008
 Falguni
 Complete Aditions*/

int main() 
{
  int i,j;

  cout <<"Rectangular triangle using * is :\n"; 

  for (i=0;i<6;i++)
  {
      for (j=0;j<i;j++)
      {
          cout <<"*\t";
      } 
      cout <<"\n";
  }

return 0;

}

2)Number is odd or even:

#include<iostram.h>
/* Worksheet III
  31st July,2008
  Falguni
  Complete Additions*/

int main() 
{
  int num1;


  Cout<<"please enter the number u want to check\n";
  cin>>num1;

  if (num1%2==0)
  {
      cout>>"The entered no "<<num1<<"is even";
  }
  else
  {
      cout>>"The entered no "<<num1<<"is even";
  }
return 0;
}

3)Number is multiple of small or not

#include<iostram.h>
/* Worksheet III
  31st July,2008
  Falguni
  Complete Additions*/

int main() 
{
 
 int num1,num2,max,min;
 char answer;

 cout<<"Enter two numbers\n";
 cin>>num1;
 cin>>num2;

 if(num1>num2)
   { 
     max=num1;
     min=num2;
   }
 else 
   {
     max=num2;min=num1;
   }

 if (max%min==0)
   {
    cout<<max<<"is multiple of "<<max"\n";
    cout<<"Satisfied with the answer?";
   }
}
commented: I hope you get an A for his course -7

Ha!,

Thanks alot for the code, it was of great help... took my a while to understand it but I finally could get to something!, sorry to reply 4 days after but the reply message just appeared.

Thanks alot for the help, im done here
Michel,

You are most welcome,dear...
No need to say sorry.

Falguni.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.