Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,207,862 members, 8,000,632 topics. Date: Tuesday, 12 November 2024 at 12:59 PM |
Nairaland Forum / Science/Technology / Programming / C++ Beginner Discussion Room: Drop Your Codes (11815 Views)
I Want To Hire A Beginner Who Is Willing To Learn New Skills / Special Codes To Format Text On Nairaland / Should A Beginner Learn 2 Programming Languages At Once? (2) (3) (4)
(1) (2) (3) (4) (5) (Reply) (Go Down)
C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 9:07pm On Nov 29, 2013 |
here is mine //c++ code that ask for user day off and fix the date. // by xarm d young programmer #include <iostream> #include <cmath> #include <cstdlib> #include <string> #include <sstream> #include <ctime> using namespace std; int main() { enum Days {Sunday, Monday, Tuesday, Wednessday, Thursday, Friday, Saturday}; Days DayOff; int dayOffNum; cout << "Which day will you like to be off (0-6): " << endl; cin >> dayOffNum; DayOff = Days (dayOffNum); if ( DayOff == Sunday || DayOff == Saturday) { cout << "Sorry!! you are off this day already" << endl; } else { cout << "I will fix the day for your vacation. Thank you!!" << endl; } } more....… 1 Like 1 Share |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 9:08pm On Nov 29, 2013 |
#include <iostream> #include <cmath> #include <cstdlib> #include <string> #include <sstream> using namespace std; int main() { string mystr; double price = 0; int quantity = 0; double total = 0; cout << "Enter price: ($) " << endl; getline (cin, mystr); stringstream (mystr) >> price; cout << "Enter quantity" << endl; getline (cin, mystr); stringstream (mystr) >> quantity; total = price * quantity; cout << "Total Price: $" << total << endl; return 0; } 1 Like |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 9:09pm On Nov 29, 2013 |
//an app for lotto or magic number #include <iostream> #include <cstdlib> #include <cmath> #include <ctime> using namespace std; int main() { int magic; //magic number int guess; //user's guess magic = 1 + (rand() % 6);//get a random number cout << "Enter your guess: (1 - 6) " << endl; cin >> guess; if (guess == magic) { srand(time(0)); cout << "***You WIN!!!**** " << endl; } else { cout << "Sorry!! You LOOSE!!!! " << endl; if ( guess > magic ) { cout << "Your guess is to high" << endl; } else { cout << "Your guess is too low" << endl; } } } |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 9:10pm On Nov 29, 2013 |
#include <iostream> #include <cmath> #include <cstdlib> #include <string> #include <sstream> using namespace std; int sum(int a, int b); void printResult(int a, int b); int main() { int x = 0; int y = 0; cout << "Enter the first Number: " << endl; cin >> x; cout << "Enter the second Number: " << endl; cin >> y; printResult(x, y); return 0; } void printResult(int a, int b) { cout << "Addition of d two numbers is " << sum(a, b); } int sum(int a, int b) { return (a + b); } |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 9:10pm On Nov 29, 2013 |
//my c++ Interest Rate or Gain calculator for 30days //depend on the user input //author: xarmzon aka d young programmer #include <iostream> #include <cmath> #include <cstdlib> #include <string> #include <sstream> #include <ctime> using namespace std; int main() { double a; double p = 0; double r; int c = 0; int x; cout << "This little app help you to calculate your gain for 30days base on your principal and rate." << endl; cout << endl; cout << "Press 1 to continue or -1 to quit" << endl; cin >> x; switch (x) { case 1: cout << "Enter the Principal #:" << endl; cin >> p; cout << "Enter the Rate (eg: .03):" << endl; cin >> r; for (int day = 1; day <= 30; day++) { a = p * pow(1+r, day); cout << endl; cout <<"In day(s)\t " << day << "\t You get\t " << a << endl; while (c == 10) { cout << endl; c = 0; } } break; case -1: cout << "You Quit. Thank You for using this app!!!" << endl; default: cout << "Invalid Input" << endl; } } |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 9:13pm On Nov 29, 2013 |
Drop your..... NOTE; this tread mainly for beginner like me!!! pro can help us to check the code and review it, give us more note or assignment, ebooks etc. currently using code::blocks and c4droid on my android. thanks |
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 12:10pm On Nov 30, 2013 |
adelolaa: Drop your.....bro du u mean code::blocks does run perfectly well on ur android device? If yes whats brand of android r u using...ill like 2 get 1 fmy humble self...thanks |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 8:35pm On Nov 30, 2013 |
wisemania: code::blocks for my PC and c4droid for my #team_tecno m3 |
Re: C++ Beginner Discussion Room: Drop Your Codes by Nobody: 12:36am On Dec 01, 2013 |
Add a while loop to ur magic number program so that the game is gon keep prompting the user to enta a number til he guesses the computer number |
Re: C++ Beginner Discussion Room: Drop Your Codes by Nobody: 12:46am On Dec 01, 2013 |
adelolaa: //an app for lotto or magic number |
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 12:43pm On Dec 01, 2013 |
OP: i'd love to contribute my quota 2 dis tred...bt my hands r tied coz of d theme of d thread...kud u plss edit it..so dat C newbies can also contribute... Thank you. |
Re: C++ Beginner Discussion Room: Drop Your Codes by Olyboy16(m): 3:13am On Dec 02, 2013 |
Hello guys...assignment... Load the serial number and scores of 50 students in a class either hardcoded or prompting in a 2d array, then simply find the serial number with the highest score(u cn use 1d array if u cn achieve d same result) goodluck friends!! 1 Like |
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 10:12am On Dec 02, 2013 |
following.. also a beginner |
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 5:48pm On Dec 05, 2013 |
adelolaa:bro how du u make ur programs interactive using d c4droid compiler... Coz i installed it yesterrday ran some codes on it,it ran perfectly well....but wen i tried makin it interactive using the input function ("scanf" for C-program and "cin" for c++ programs), the compiiler just ignored it like it waz neva there in my codes....d codes i ran could only print characters,i'd like u 2 explain in plain eng how u get 2 make ur own codes interactive using d "cin" command to read inputs from a user....*waiting patiently* |
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 6:15pm On Dec 05, 2013 |
@op: sorry,wher did u download ur c4droid 4rm, waz it free?,coz i waz asked to pay 4 mine...bt didnt....i had to download d online version,n its kilin my mb like kilode!...pls giv me a link to download d free offline version..thanks |
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 1:37pm On Dec 07, 2013 |
wisemania:ur probably using the wrong compiler.. mine is working pretty well.. |
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 1:38pm On Dec 07, 2013 |
wisemania: @op:downloaded mine from playstore and it's offline.. |
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 2:10pm On Dec 07, 2013 |
raynold: downloaded mine from playstore and it's offline..was it free? If yes,whats d name and version of ur compiler?..waiting.... |
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 3:52pm On Dec 07, 2013 |
wisemania:yes free.. c4droid I think it's the latest version since I haven't recieve any update notification since I downloaded it.. |
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 12:18pm On Dec 08, 2013 |
raynold: yes free.. c4droid I think it's the latest version since I haven't recieve any update notification since I downloaded it..thanks,ill check it out 2nyt... One more tin,did u also download gcc and sdl? |
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 1:02pm On Dec 08, 2013 |
wisemania:just gcc |
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 11:14am On Dec 09, 2013 |
raynold: yes free.. c4droid I think it's the latest version since I haven't recieve any update notification since I downloaded it..bro c4droid isnt free in anyway...i tried numerous downloads bt dey kept on asking 4 me for my credit card details....anywaz ill av 2buy it ...al d xame ,thanks 4ur hlp thus far.... |
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 8:04am On Dec 10, 2013 |
wisemania:okay.. mine was free tho(playstore).. except the developer just made it a paid app. |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 10:55pm On Dec 10, 2013 |
thank you all. I will dropbox my c4droid |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 10:57pm On Dec 10, 2013 |
currently working on this assignment Assignments: (if, else if and else statement) HOD: ALEX ALLAIN STUDENT: XARMZON COURSE: JUMPING INTO C++ Q1: Ask the user for two user's ages, and indicate who is older, behave differently if both are over 100. Q2: Implement a simple "password" system that takes a password in the form of a number. Make it so that either of the two numbers are valid, but use only one if statement to do the check. Q3: Write a small calculator that takes as input one of the four arithmetic operations, the two argument to those operation, and then print out the result. Q4: Expand the password checking program from earlier in this chapter and make it multiple usernames. Each with their own password and provide the ability to prompt user's again if the first attempt failed. Think about how easy(or hard) it is to do this for a lot of usernames and password. |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 11:05pm On Dec 10, 2013 |
currently reading this eBook. I recommend it for u guys too https:///jxjRBC71 c4droid link is coming too |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 11:09pm On Dec 10, 2013 |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 11:15pm On Dec 10, 2013 |
https:///pXhhjT5h here is my c4droid app. download all what the app ask you to download. good luck!!!! back to my assignments. |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 11:19pm On Dec 10, 2013 |
/******************************** Assignments: (if, else if and else statement) HOD: ALEX ALLAIN STUDENT: XARMZON COURSE: JUMPING INTO C++ Q1: Ask the user for two user's ages, and indicate who is older, behave differently if both are over 100. Q2: Implement a simple "password" system that takes a password in the form of a number. Make it so that either of the two numbers are valid, but use only one if statement to do the check. Q3: Write a small calculator that takes as input one of the four arithmetic operations, the two argument to those operation, and then print out the result. Q4: Expand the password checking program from earlier in this chapter and make it multiple usernames. Each with their own password and provide the ability to prompt user's again if the first attempt failed. Think about how easy(or hard) it is to do this for a lot of usernames and password. SOLUTION TO Q1: ********************************/ #include <iostream> #include <string> using namespace std; int main() { int firstAge; int secondAge; cout << "Enter the first and second person age " << endl; cin >> firstAge >> secondAge; if (((firstAge && secondAge) < 100) && ((firstAge && secondAge) >= 1)) { if (firstAge > secondAge) { cout << " First person is older than second person" << endl; } if (firstAge < secondAge) { cout << "Second Person is older than first person" << endl; } } if (firstAge && secondAge >= 100) { cout << "Both ages is 100 or greater than 100" << endl; } else { cout << "Invalid Ages" << endl; } } |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 11:20pm On Dec 10, 2013 |
/******************************** ASSIGNMENT: write a program that declares a class called "employee" with these data members: itsAge, itsYearsOfService, itsSalary. HOD: Teach ur self c++ in 21days STUDENT: Xarmzon. ********************-***********/ #include <iostream> #include <cstdlib> #include <cmath> #include <string> #include <ctime> using namespace std; class employee { public: int getAge(){ return itsAge; } void setAge(int age){ itsAge = age; } int getYearsOfService(){ return itsYearsOfService; } void setYearsOfService(int yearsOfS){ itsYearsOfService = yearsOfS; } int getSalary(){ return itsSalary; } void setSalary(int salary){ itsSalary = salary; } private: int itsAge; int itsYearsOfService; int itsSalary; }; int main() { string name; employee age; age.setAge(20); employee year; year.setYearsOfService(6); cout << "Enter your name: "; getline (cin, name); cout << name << " is "<< age.getAge() << " years of age and " << year.getYearsOfService() << " years of age in service." <<endl; } |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 11:21pm On Dec 10, 2013 |
#include <iostream> #include <string> using namespace std; int main() { cout << "L3 leaders List" << endl << endl; cout << "Admin:\t\t\t Sete\n" << endl; cout << "Asst. admin:\t\t Xarm\n" << endl; cout << "Group attendant:\t Jeff\n" << endl; cout << "Group Monitor:\t\t Judinho\n" << endl; cout << "Group Noise Maker!:\t Doglaries\n" << endl; cout << endl; cout << "watch out for d rest of the name!!!!!!!"; } |
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 11:26pm On Dec 10, 2013 |
wisemania: can u upload d code and let me review it coz mine is working perfectly here |
Which Nigeria University Are Good For Computer Science?? / Are You On The Dark Web? / Can You Write Codes With A Tablet Instead Of A Laptop?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 97 |