Anonymous
Need sorce code c++
Google it as suggested above and even mentioned what to google
Anonymous
// home 6 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { int age, approved; char job, house; char rating[15]; int rate = 0; printf("---=== Credit Card Application ===---\n"); printf("Enter your age: "); scanf("%d", &age); printf("Do you have a job? "); scanf(" %c", &job); printf("Do you own a house? "); scanf(" %c", &house); printf("Enter the credit rating: "); scanf("%s", rating); if (rating[0] == 'F') { rate = 1; } else if (rating[0] == 'G') { rate = 2; } else if (rating[0] == 'E') { rate = 3; } else { rate = 0; } //printf("rate: %d", rate); if (age > 55) { if (rate >= 2) { approved = 1; } else { approved = 0; } } else if (age >= 35) { if (house == 'y') { approved = 1; } else { approved = 0; } } else if (age >= 18) { if (job == 'y') { approved = 1; } else { approved = 0; } } if (approved == 1) { printf("approved"); } else if (approved == 0) { printf("not approved"); } else { printf("input wrong data type"); } return 0; }
Rakesh
Ok thanks ❤️🙏
Let me bring that for you
Anonymous
// home 6 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { int age, approved; char job, house; char rating[15]; int rate = 0; printf("---=== Credit Card Application ===---\n"); printf("Enter your age: "); scanf("%d", &age); printf("Do you have a job? "); scanf(" %c", &job); printf("Do you own a house? "); scanf(" %c", &house); printf("Enter the credit rating: "); scanf("%s", rating); if (rating[0] == 'F') { rate = 1; } else if (rating[0] == 'G') { rate = 2; } else if (rating[0] == 'E') { rate = 3; } else { rate = 0; } //printf("rate: %d", rate); if (age > 55) { if (rate >= 2) { approved = 1; } else { approved = 0; } } else if (age >= 35) { if (house == 'y') { approved = 1; } else { approved = 0; } } else if (age >= 18) { if (job == 'y') { approved = 1; } else { approved = 0; } } if (approved == 1) { printf("approved"); } else if (approved == 0) { printf("not approved"); } else { printf("input wrong data type"); } return 0; }
In line number 3 of your output: The output should be: Enter your age: Do you have a job? Do you own a house? Enter the credit rating: approved ^ But your output is: Enter your age: Do you have a job? Do you own a house? Enter the credit rating: not approved ^ Unmatched character details: The character in column 81 is supposed to be: [a] ASCII code(97) but you printed [n] ASCII code(110)
Anonymous
how i can fix out the problem!! thank yiu !!!
Anonymous
Anonymous
Use if conditions then and calculate answer
hello can you send me the entire code?
Anonymous
Anonymous
- malloc and realloc may return null pointer. Check it. - Line 23. "n" -> "n-1" to avoid out of bounds. - Line 26. "m-1" -> "m". Otherwise you will get wrong output. - Line 31. Don't free arr. Its invalid. Instead, free arr_new.
👍 Everyone here asks people to post the code but very few of them actually go through it to see what problems the coder is facing. Good job. I know that the admin @ollirz goes through it and helps people. Most of them just ignore the code after it has been posted.
Anonymous
******************************************************************** UDF for integrating turbulent dissipation and displaying it in the console *********************************************************************/ #include "udf.h" DEFINE_ADJUST(my_adjust,d) { Thread *t; /* Integrate dissipation. */ real sum_diss=0.; cell_t c; thread_loop_c(t,d) { begin_c_loop(c,t) sum_diss += C_D(c,t)* C_VOLUME(c,t); end_c_loop(c,t) } printf("Volume integral of turbulent dissipation: %g\n", sum_diss); }
Anonymous
i am trying to run test code from my training manual in VS Code but its throwing error in udf.h header file doesnt exist
Anonymous
udf.cpp:5:17: fatal error: udf.h: No such file or directory #include "udf.h"
Anonymous
how to make headers integrated to VS Code environment?
Good
How you running the code ? Using command or code runner?
Anonymous
In visual studio code
Anonymous
Any suggestion fr best code runner fr C++ which integrate all header files from other programmes?
💯 Voldemort
Can online help me out with this problems 🙄#include<stdio.h> int main() { int i,j,k; for(i=1,j=0,k=3;i<=5,j<=6,k>1;i++,j++,k--); { printf("%d\n%d\n%d\n",i,j,k); } return 0; }
Good
You can use cmake or make files and specify the source and header files.
💯 Voldemort
Anyone*
mito
is there a 1byte integer data type in c++ ?
Good
It will helps you to understand each variable
💯 Voldemort
Use some debugger (gdb) or ide to debug the code
I have done that and got the answer but I want to know execution process of this code.
mito
Yes, int8_t
what's the default? signed or unsigned?
Good
*comma(,)
mvmt
what's the default? signed or unsigned?
it's signed, uint8_t for unsigned
mito
Yes, int8_t
its outputting the corresponding ASCII character :/ not the integer.
💯 Voldemort
That's what gdb is for
Can I install gdb in vs code windows ?
💯 Voldemort
You mean usage of coma(,)
No I mean...I want to know the steps and want to understand the code that how can I solve it without compiling
Good
No I mean...I want to know the steps and want to understand the code that how can I solve it without compiling
😁 for that you need to take one paper write down the variables and initial values update the values for each iteration
mvmt
its outputting the corresponding ASCII character :/ not the integer.
This may help: https://www.learncpp.com/cpp-tutorial/fixed-width-integers-and-size-t/
mito
#include <iostream> int main() { int8_t a = 67; int8_t b = 65; std::cout<<a<<"\n"; return 0; } This prints the ASCII value corresponding to 67. #include <iostream> int main() { int8_t a = 67; int8_t b = 65; std::cout<<a+b<<"\n"; return 0; } This prints the values 132. How does this work?
mito
Implicit conversion to int I think
yes 😁 i just did sizeof(a+b) and its 4 bytes... and also adding int8_t a = 67; int8_t b = 65; becomes greater than 128, i was thinking that might be the case.. but if I had int8_t a = 60; int8_t b = 61; Adding this would be less than 128, but sizeof(a+b) is 4 bytes for this too :( I wonder if explicit conversion like int8_t(a+b) would work or not..
Igor🇺🇦
?
What do you mean "internal pointers in C/C++“?
Igor🇺🇦
It is a blog for example
Blog about C++? I thought you are talking about some type of pointers in C. Here Jason Turner talks about useful C++ resources: https://youtu.be/eSDVVrjFh54
Ameemo
Am doing c++ exercise am stuck what is the problem with my code #include <iostream> using namespace std; int main() { int distance , sum=0 , i=0; cout << "Enter total distance: "; cin >> distance ; while (distance <= sum) { i++; switch (i) { case 1: sum = sum + 10; break; case 2: sum = sum + 20; break; case 3: sum = sum + 30; break; default: sum = sum + 40; break; } cout << "After " << i << "bottle(s) at: " << sum << " km"; } cout << "Our hero needs " << i << " bottle(s) of orange juice."; return 0; }
Li
why the clang-tidy show this ?
Li
'algorithm' file not foundclang-tidy(clang-diagnostic-error)
Mahi_way❤
Does anyone know how to create webpage using ruby?
Mahi_way❤
Kindly guide me fr the above!👆
Mahi_way❤
C++ isn’t ruby…
no nt abt c++
'''''''
no nt abt c++
Then u r in the wrong group
Rajputana
how to print address of a system file using c can i print it?
Rajputana
Address of a system file?
You can consider any file on computer memory it must have some address in memory can I find that address using pointers?
Talula
You can consider any file on computer memory it must have some address in memory can I find that address using pointers?
Err... file and memory and address? File is stored on a drive it could be a normal HDD or SDD or whatever... Memory is normally referred to in computer as RAM, it doesn't store file in a file format or name... So you're mixing up things.
Talula
Clear up the mess for him then
I can't clear it, just told him that what he is talking about isn't making sense.
Talula
But when it is open it occupies some space in the memory it must have some address right.
To get the address, you have to first check if the class that you're using to open these specific files allow you access to memory area.
Talula
But when it is open it occupies some space in the memory it must have some address right.
It depends from file to file, class to class... if you're opening a text file then you are storing the information in a variable, which you can get pointer to by using &variableName
Rajputana
Thank you @Tazmikar my doubt is cleared now.
Anonymous
Thank you but I am using windows
Windows should have an equivalent tool. C or C++ doesnt have a standard utility to do this because the standard doesnt deal with the OS's realm. You open a file using a system call and only the underlying OS can maintain this information for you.