Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C++ halp

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam
View previous topic :: View next topic  
Author Message
hacksign23
Master Cheater
Reputation: 0

Joined: 26 Nov 2006
Posts: 404

PostPosted: Sat Feb 07, 2009 3:16 am    Post subject: C++ halp Reply with quote

I made this code. It works perfectly, but I think there's a better and more effective way to do this. Any ideas? Oh, what it does is make roman numerals and a weird name thingy.
Code:


// learning.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

using namespace std;

string start();
string loop();
string end(string out);
void extra(string character, string past);
int co;
string out;


int _tmain(int argc, _TCHAR* argv[])
{


cout << "enter your name!" << endl;

string name;
string top;
string middle = "* ";
string bottom;
int namesize;
int i;
getline(cin, name);
namesize = name.length();
for(i=0;i!=(namesize+4);i++){
   top+= '*';
}
middle += name + " *";
bottom = top;
cout << top << newline << middle << newline << bottom <<newline;
cout << start() << endl;;
system("PAUSE");
}


string start() {
   string s;
   int i;
   getline(cin,s);
   for (i = 0; i!=  s.size() ; i++) {
      if (isdigit(s[i]) == 0){
         cout << "DIS INCORRECTS! (not a number)"<<endl;
         return NULL;
      }
   }
      co = atoi(s.c_str());
      s = loop();
   return(s);
   
}


string loop() {

   if (co >= 1000) {
      out.insert(out.size(),"M");
      co-= 1000;
      loop();
   }
   if (co >= 500) {
      if (co >= 900){
         co -= 900;
         extra("M","C");
      }else{
      out.insert(out.size(),"D");
      co -= 500;   
      loop();

      }
   }

   if (co >= 100) {
      if (co >= 400){
         co -= 400;
         extra("D","C");
      }else{
      out.insert(out.size(),"C");
      co -=100;
      loop();
   }
   }
   if (co >= 50) {
      if (co >= 90){
         co -= 90;
         extra("C","X");
      }else{
      out.insert(out.size(),"L");
      co -=50;
      loop();
   }
   }
   if (co >= 10){
      if (co >= 40){
         co -= 40;
         extra("L","X");
      }else{
      out.insert(out.size(),"X");
      co-=10;
      loop();
   }
   }
   if (co >= 5) {
      if (co >= 9) {
         co -= 9;
         extra ("X","I");
      }else{
      out.insert(out.size(),"V");
      co -=5;
      loop();
   }
   }
   if (co >= 1) {
      out.insert(out.size(),"I");
      co -=1;
      loop();
   }

return out;
}
void extra(string character, string past){
   out.insert(out.size(), past);
   out.insert(out.size(),character);
   loop();
   return;
}

_________________
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites