64 Posted Topics
Re: What you want to do is handle the white spaces on your cardNames or change the formatting. It thinks that there are more than 6 variables. #include <iostream> #include <iomanip> #include <fstream> using namespace std; //Prototype void readCards(); int main() { readCards(); return 0; } void readCards() { const int … | |
Re: My advice is learn about threads to do it in real-time. Otherwise, load/generate everything that is needed, **before** you start battles. Then, see what direction you need to go. Benchmarking your design is just part of the process. | |
Re: While it's a partial answer, it shows the concepts using your text file. #include <iostream> #include <fstream> #include <string> #include <stdlib.h> #include <vector> #include <algorithm> using namespace std; std::string f_ssn; std::string array_namef[10] = { "" }; std::string array_namel[10] = { "" }; std::string array_ssn[10] = { "" }; std::string array_bmi[10] … | |
Re: When you: 32: getline(cin,name); You don't consider spaces, resulting in the last name being bad input for the next input, id, causing the loop. You could just add another getline(cin, last_name); or just use: cin >> first_name >> last_name; Note the differences in the working linked list below. #include<iostream> #include<string> … | |
Re: Here, you can use a struct with integers from a file, and sort them. First, it takes them as a string, converts them to integers, builds an integer array, then uses a vector to sort ascending. #include <string> #include <iostream> #include <fstream> #include <algorithm> #include <vector> #include <sstream> using namespace … | |
Re: Reset the counter between file reads. #include <iostream> #include <fstream> #include <string> using namespace std; int counter = 0; void tagReader(ifstream& inFile, int counter); string file = "tags1.txt"; int main(){ ifstream inFile; inFile.open(file, ios::in); tagReader(inFile, counter); file = "tags2.txt"; inFile.open(file, ios::in); tagReader(inFile, counter); system("pause"); return 0; } void tagReader(ifstream& inFile, … | |
Re: What I would look for causes: 1) header file syntax 2) A semi-colon ; error e.g., void install(); { } e.g., excuses[y=5]=excuses[y] 3) You have a function that is conflicting with another function. e.g., void install() { void uninstall() { } } 4) There is a } bracket missing or … | |
Re: Solved? This is how I solve 10 trials and display each time a "paradox" is found. #include <iostream> #include <cstdlib> #include <cmath> #include <ctime> #include <random> #include <iomanip> int para(); int reset(); double paradox = 0; int trial = 1; int debug = 1; int main() { reset(); para(); } … | |
Re: Here is a solution that you can use, that will do what you asked. #include <fstream> #include <iostream> #include <string> #include <vector> #include <iomanip> #include <regex> using namespace std; int debug = 1; int z = 0; int ct = 0; int match0 = 0; int chr = 0; string … | |
Re: With limited information, you can probably use some of these ideas. #include <iostream> #include <string> int countGender(); int countSemester(); int determinePerceptionLevel(); int loop = 0; int respondents = 0; std::string student_id = ""; std::string array_id[100] = { "" }; double array_marks[100] = {0.0}; int gender = 0; int male = … | |
Re: A starter program, that should do what you want. #include <iostream> double result = 0.0; double lb = 0.0; double kg = 0.454; int main() { while (1) { std::cout << "Enter pounds (lb) to be converted to kilograms (kg): "; std::cin >> lb; result = lb * kg; std::cout … | |
Re: All you have to do is compare the counters against 0. How did your assignment turn out? void namep(int nump) { cout << "\n\t\tPhone :"; if (num1 > 0) { cout << "\n\t\tXiaomi Poco M3 Pro 5G\t\tx " << num1 << " [ RM 599 ]"; } if (num2 > … | |
Re: // Joshua Haglund #include <iostream> #include <cmath> float a = 0; float b = 0; float c = 0; int main() { while (1) { std::cout << "\n"; std::cout << " Enter 2 numbers greater than 0.\n"; std::cout << "\n"; std::cout << " First number: "; std::cin >> a; std::cout … | |
Re: You are on the right track evilguyme. Try this: HDC hDC = GetDC(0); // color you are looking for const int r1 = 255; const int g1 = 255; const int b1 = 255; //HWND hwnd = FindWindow(NULL,"Test - Microsoft Visual Studio"); //SetForegroundWindow(hwnd); HDC hdc = GetDC(HWND_DESKTOP); |
The End.