Sirnuel's Posts
Nairaland Forum › Sirnuel's Profile › Sirnuel's Posts
It has happened to the best of us.... I almost called it quit. The trick is to not quit. . . Eat sleep and try again Dont forget to Keep practicing the little you have learnt |
I can do it in android and java call me 08115056400 |
See this one just pack all her problem put for one chinko laptop. . . . . If you will sale it for 40k leme know |
enshy:Stop quoting the bible out of context bro... . . will this your advice still stand if the second wive was to be your sister. . moreover the Bible never said a man cannot marry more than one wife. . . . . . God knows if I have enough money, i will marry more than two ooo... I go be father of many nation bro. |
I am also from enugu. . learned c++ but discovered without java you cannot bea great android developer. currently learning JAVA |
All I see is someone proud of what she does... Plus very cautious too. . . . Unlike all those church whores wey dey spread HIV and STDs like rumours. |
Tell am say Arsenal go cut that slip |
LEARN C AND C++ THANK ME LATER |
. |
using c++ ====================================================================== #include <iostream> using std::cin; using std::cout; int main(){ cout << "A program to find the nth term of a sequence with the difference (+3) and (-2)\n\n"; int first; int nth_term; cout << "Enter the first term of the sequence: \t"; cin >> first; cout << std::endl; cout << "Enter the nth term you want to find: \t"; cin >> nth_term; cout << std::endl; int answer = first; for (int i = 0; i < nth_term; i++){ cout << answer << " "; if ((i%2)!= 0){ answer = (answer + (-2)); } else { answer = (answer + 3); } } cout << "\n\n"; cout << "The " << nth_term << " of the sequence is: " << answer; return 0; } |
//in C++, using recursion; #include <iostream> int factorial (int x); //function prototype using namespace std; int main (){ int x; int fact; cout << "\nEnter a positive integer: \t"; cin >> x; fact = factorial(x); cout << "The factorial of " << x << " is " << fact; return 0; } //function definition; int factorial (int x){ if(x == 1) {return 1;} else {return x*factorial(x-1);} } //in C++, using iteration; #include <iostream> using namespace std; int main (){ int x; int fact = 1; cout << "\nEnter a positive integer: \t"; cin >> x; cout << "The factorial of " << x << " is "; //forever loop for(; {if (x == 1){ break; } else { fact = fact * x; x--; } } cout << fact << endl; return 0; } |
3 fishes |
. |
BlackAlbino6:See person dey talk dey judge himself |
WhiZTiM:Thanks.... I also found few bugs out on my own too. the program now runs smoothly |
codemarshal08:.yes it compiled successfully |
I can't seem to find the bug in this my program ==================================================================== roman_to_dec.h #include <string> using namespace std; int M, D, C, L, X, V, I; class romanType{ public: romanType(); void set_roman_type(string); int get_roman_type()const; int convert_rom_to_dec(); int get_answer_in_decimal()const; ~romanType(); private: int answer_in_decimal; string roman; }; ----------------------------------------------------------------------------------------------------------------------------- roman_to_dec.cpp #include <iostream> #include <string> #include <cstring> #include "roman_to_dec.h" int display_menu(); void switch_stat(int, romanType); using namespace std; int input; romanType::romanType(){ answer_in_decimal = 0; roman = " "; } void romanType::set_roman_type(string x){ for(int i = 0; i < 10; i++ ) x[i] = roman[i]; } int romanType::convert_rom_to_dec(){ int answer; int roman1, roman2; string::size_type i = 0; while (i < roman.length()){ switch(toupper(roman.at(i))){ case 'M': roman1 = 1000; break; case 'D': roman1 = 500; break; case 'C': roman1 = 100; break; case 'L': roman1 = 50; break; case 'X': roman1 = 10; break; case 'V': roman1 = 5; break; case 'I': roman1 = 1; break; default: roman1 = -1; } switch(toupper(roman.at(i + 1))){ case 'M': roman2 = 1000; break; case 'D': roman2 = 500; break; case 'C': roman2 = 100; break; case 'L': roman2 = 50; break; case 'X': roman2 = 10; break; case 'V': roman2 = 5; break; case 'I': roman2 = 1; break; default: roman2 = -1; } if ((roman1 == -1) || (roman2 == -1)){ cout <<"\n\n\tError incorrect input"; return -1; } else if (roman1 < roman2){ answer = roman2 - roman1; i +=2; } else if (roman1 >= roman2){ answer += roman[i]; i +=1; } } answer_in_decimal = answer; return answer; } int romanType::get_answer_in_decimal()const{ return answer_in_decimal; } romanType::~romanType(){ cout << "calling destructor"; } int display_menu(){ cout << "\n\t---------------------------------------------------------------------"; cout << "\n\t---------This program converts Roman Numerals to Decimals -----------"; cout << "\n\t| |"; cout << "\n\t| |"; cout << "\n\t| Press 1 to perform a new converstion |"; cout << "\n\t| |"; cout << "\n\t| |"; cout << "\n\t| Press 2 to view last result |"; cout << "\n\t| |"; cout << "\n\t| |"; cout << "\n\t| Or press 0 to exit |"; cout << "\n\t| |"; cout << "\n\t| |"; cout << "\n\t---------------------------------------------------------------------\n\n\t"; cin >> input; while ((input != 0) && (input > 2)){ cout << "error incorrect input\n try again"; cout << "\n\t---------------------------------------------------------------------"; cout << "\n\t---------This program converts Roman Numerals to Decimals -----------"; cout << "\n\t| |"; cout << "\n\t| |"; cout << "\n\t| Press 1 to perform a new converstion |"; cout << "\n\t| |"; cout << "\n\t| |"; cout << "\n\t| Press 2 to view last result |"; cout << "\n\t| |"; cout << "\n\t| |"; cout << "\n\t| Or press 0 to exit |"; cout << "\n\t| |"; cout << "\n\t| |"; cout << "\n\t---------------------------------------------------------------------\n\n\t"; cin >> input; } return input; } void switch_stat(int input, romanType roman_type){ string input_roman; switch(input){ case 0: cout <<"exiting the program\n\n"; break; case 1: cout << "input the numbers in roman figures:\t"; cin >> input_roman; roman_type.set_roman_type(input_roman); roman_type.convert_rom_to_dec(); cout << "\n\n\t" << input_roman << " = " << roman_type.get_answer_in_decimal()<< "in decimal"; cout << endl; break; case 2: cout << "testing case.......it works"; break; default: cout << "\n\tError 505....Incorrect input!!!"; break; } } -------------------------------------------------------------------------------------------------------------------------------- roman_to_dec_main.cpp #include <iostream> #include "roman_to_dec.cpp" int main(){ romanType roman_type; int input = display_menu(); switch_stat(input, roman_type); return 0; } ---------------------------------------------------------------------------------------------------------------------------------- this is the error i get whenever i try to run the program termincate called after throwing an instance of 'std::out_of_range' what(): basic_string::at _n (which is 1) >= this->size() (which is 1) this application has requested the Runtime to terminate it in an unusual way. Please contact he application's support team for more information. |
. |
I am learning c++ as a first language and it's frustrating as hell... Please recommend any study materials most especially videos Thanks in advance |
Please I have three questions Is there any website aside the random google search for downloading stock roms and firmwares for android phones ?? And secondly, Aside SP flash tool, is there any other tools for flashing a rom to an android phone? One more Please How can one flash china phones like none android techno, itel etcetera Please can anyone invite me into that android forum whatsapp group? |
Is it the swearing in that happened decades ago or is there another one upcoming?? Why didn't the family members go to the police earlier. Anyways, I pray he is found in perfect health condition and all his body parts intact. |
EngrBouss:would be needing about 5 of those videos Email me: sirnuell@gmail.com |
gentlejoe1:i stay in Enugu distance is a problem |
gentlejoe1:where do u reside |
Please which good phone can I get with a budget of 25K |
hope am not late sirnuell@gmail.com |
osas5683:I blame your Illiterate dad for having to sleep with that LovePeddler of a woman you call mother without condom |
I am planning to apply for the up comming Airforce recruitement. Pls what are my chances of success. |
{