My Assignment: #include double average(double grades[], int numGrades); int main () { double grades[] = {93,100,98,100,100,100}; int numGrades = sizeof(grades)/sizeof(grades[0]); double averageGrade = average(grades, numGrades);
Search for existence and index of a specific element in array of any data type template int SearchArr(T arr[], int arrSize, T targ){ for (int i = 0 ; i
It doesn't matter since the int returned is actually the index of your number. -1 could be the 6th integer but nver the -1st integer, that doesn't make sense
#include
int searchArray(std::string array[], int size, std::string element);
int main()
{
std::string foods[] = {"pizza", "hamburger", "hotdog"};
int size = sizeof(foods)/sizeof(foods[0]);
int index;
std::string myFood;
std::cout
well explained bro
Great explanation,brooooooooo)
A Multiplatform GUI with c++ tutorial would be really cool. For example, the qt framework
very nice
My Assignment:
#include
double average(double grades[], int numGrades);
int main () {
double grades[] = {93,100,98,100,100,100};
int numGrades = sizeof(grades)/sizeof(grades[0]);
double averageGrade = average(grades, numGrades);
std::cout
Search for existence and index of a specific element in array of any data type
template
int SearchArr(T arr[], int arrSize, T targ){
for (int i = 0 ; i
🔥🔥❤❤DONE🔥🔥❤❤
❤❤🎉🎉🎉
What if I want a -1 in my array?
Return another number or a text
It doesn't matter since the int returned is actually the index of your number. -1 could be the 6th integer but nver the -1st integer, that doesn't make sense
If you can use this in program example user searching any this ??
not working for me :(
Hey, make sure your index = searchArray(numbers, size, myNum); line comes AFTER your user input prompt. I had this issue. I hope it solves yours.
Use libraries
sizeof(a) //
typeid(a) // #include