• Feb 4, 2021 •aedrarian
0 likes • 0 views
#include <iostream> using namespace std; main { cout << "No tabbing. That's very sad :(\n"; cout << "No in-editor highlighting either :(((\n"; cout << "Descriptions might be niice too."; }
• Nov 18, 2022 •AustinLeath
0 likes • 5 views
#include <iostream> using namespace std; /* Function: get_coeff Parameters: double& coeff, int pos passed from bb_4ac Return: type is void so no return, but does ask for user to input data that establishes what a b and c are. */ void get_coeff(double& coeff, int pos) { char position; if(pos == 1) { position = 'a'; } else if(pos == 2) { //a simple system to determine what coefficient the program is asking for. position = 'b'; } else { position = 'c'; } cout << "Enter the co-efficient " << position << ":"; //prompt to input coeff coeff = 5; //input coeff } /* Function: bb_4ac Parameters: no parameters passed from main, but 3 params established in function, double a, b, c. Return: b * b - 4 * a * c */ double bb_4ac() { double a, b, c; //coefficients of a quadratic equation get_coeff(a, 1); // call function 1st time get_coeff(b, 2); // call function 2nd time get_coeff(c, 3); // call function 3rd time return b * b - 4 * a * c; //return b * b - 4 * a * c } int main() { cout << "Function to calculate the discriminant of the equation. . . " << endl; double determinate = bb_4ac(); //assign double determinate to bb_4ac function cout << "The discriminant for given values is: " << determinate << endl; //output the determinate! }
0 likes • 2 views
#include <iostream> #include "PlaylistNode.h" using namespace std; void PrintMenu(string title); int main() { string plTitle; cout << "Enter playlist's title:" << endl; getline(cin, plTitle); PrintMenu(plTitle); return 0; } void PrintMenu(string title) { Playlist list; string id; string sname; string aname; int length; int oldPos; int newPos; char choice; while(true) { cout << endl << title << " PLAYLIST MENU" << endl; cout << "a - Add song" << endl; cout << "d - Remove song" << endl; cout << "c - Change position of song" << endl; cout << "s - Output songs by specific artist" << endl; cout << "t - Output total time of playlist (in seconds)" << endl; cout << "o - Output full playlist" << endl; cout << "q - Quit" << endl << endl; cout << "Choose an option:" << endl; cin >> choice; cin.ignore(); if (choice == 'q') { exit(1); } else if (choice == 'a') { cout << "\nADD SONG" << endl; cout << "Enter song's unique ID: "; cin >> id; cin.ignore(); cout << "Enter song's name: "; getline(cin,sname); cout << "Enter artist's name: "; getline(cin,aname); cout << "Enter song's length (in seconds): "; cin >> length; list.AddSong(id, sname, aname, length); } else if (choice == 'd') { cout << "\nREMOVE SONG" << endl; cout << "Enter song's unique ID: "; cin >> id; list.RemoveSong(id); } else if (choice == 'c') { cout << "\nCHANGE POSITION OF SONG" << endl; cout << "Enter song's current position: "; cin >> oldPos; cout << "Enter new position for song: "; cin >> newPos; list.ChangePosition(oldPos, newPos); } else if (choice == 's') { cout << "\nOUTPUT SONGS BY SPECIFIC ARTIST" << endl; cout << "Enter artist's name: "; getline(cin, aname); list.SongsByArtist(aname); } else if (choice == 't') { cout << "\nOUTPUT TOTAL TIME OF PLAYLIST (IN SECONDS)" << endl; cout << "Total time: " << list.TotalTime() << " seconds" << endl; } else if (choice == 'o') { cout << endl << title << " - OUTPUT FULL PLAYLIST" << endl; list.PrintList(); } else { cout << "Invalid menu choice! Please try again." << endl; } } }
• Aug 31, 2020 •joshwrou
1 like • 2 views
#include <iostream> using namespace std; int main() { cout << "Hello World!\n"; // Prints out "Hello World" return 0; }
• Apr 15, 2025 •hasnaoui1
0 likes • 4 views
int main()
#include <iostream> using namespace std; int main() { cout << "Hello, World!" << endl; return 0; }