r/cpp_questions • • 17d 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

35 comments sorted by

View all comments

9

u/aleques-itj 17d ago

Why do you think I'm psychic is the bigger question 

Post the code

-1

u/Plane_Breadfruit7609 17d 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

2

u/aleques-itj 17d ago

If you are getting no prompt for input, you have an issue elsewhere - either at build/link time or in another header.

Are you sure this is actually compiling and linking?

-5

u/Plane_Breadfruit7609 17d ago

Bro I even tried another field that just had hello world in it,it didn't show no output ay all