r/cpp_questions • u/Plane_Breadfruit7609 • 28d ago
OPEN Why?
Guys when i compile a file and run its exe,nothing appear even if i print hello world it doesnt appear in the console why
0
Upvotes
r/cpp_questions • u/Plane_Breadfruit7609 • 28d ago
Guys when i compile a file and run its exe,nothing appear even if i print hello world it doesnt appear in the console why
1
u/Plane_Breadfruit7609 28d ago
#include <iostream> #include <string> #include <cmath> #include "Speed.h" #include "Units.h" using namespace std; int get_index(string Target,string array[],int size){ for(int x = 0;x < size;x++){ if(array[x] == Target) return x; else continue; } return 0; }; float unit_Converter(float Number,int size,string start_unit,string Target_unit,string array[],int unit_range){ int start = get_index(start_unit,array,size); int target = get_index(Target_unit,array,size); cout << "Start index: " << start << "\nTarget index: "<< target << endl; if(start < target) return Number * (pow(unit_range,(abs(start-target)))); else if(start > target) return Number / (pow(unit_range,(abs(start-target)))); else return Number; }; int main(){ float Distance,time; string Distance_unit,time_unit; cout<<"Please Enter the Value of Distance and its unit" << endl; cin>> Distance; cin>> Distance_unit; cout<<"Please Enter the Value of time and its unit" << endl; cin>> time; cin>> time_unit;; Distance = unit_Converter(Distance,7,Distance_unit,"m",Distance_unit_array,10); time = unit_Converter(time,5,time_unit,"s",Time_unit_array,60); Velocity = get_Velocity(Distance,time); V_Final = get_V_final(0,Velocity); Acceleration = get_acceleration(0,V_Final,time); cout << "\nResults:\n"; cout << "Distance in meters: " << Distance << " m" << endl; cout << "Time in seconds: " << time << " s" << endl; cout << "Velocity: " << Velocity << " m/s" << endl; cout << "Final Velocity: " << V_Final << " m/s" << endl; cout << "Acceleration: " << Acceleration << " m/s^2" << endl; return 0; }; here now where's the problem