Help with a c++ program that converts numbers 1 t0 1000

  • Context: C/C++ 
  • Thread starter Thread starter mulabisc
  • Start date Start date
  • Tags Tags
    C++ Numbers Program
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 2K views
mulabisc
Messages
3
Reaction score
0
#include <iostream>
using namespace std;

int main()
{

int n;
n >=1;

count<< "please enter an interger number:" <<endl;
cin >> n;

if(n == 9)

count << "IX";

else if(n >=5 && n<=8)

count << "V";

else if (n == 4)

count << "IV";


else if(n >=1 && n <=3)

count << "I";




return 0;
}
 
Physics news on Phys.org
i wil try it n post it...thanks for the advice
 
Code:
else if(n >=1 && n <=3)

cout << "I";
This will print a I for numbers 1 to 3. You may want to check on it.

You are on the right track for 1 to 9.

Keep it up for other digits, tens, hundreds, etc.